Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone to ipad, iphone 4 uialertview problems

So I've upgraded the code to the ipad (i.e. converted to a universal app). However, the UIAlertview rendering seems to be off for IOS4. Instead of being positioned in the middle, it jumps up and is displayed on top, with half the box cut off. Same goes for landscape orientation.

It is my understanding that the UIalertview is always set in the middle? I looked through the code and I did not set up the frame/position anywhere in the code. This only happens for 4.0, on both the iphone 4 and the itouch running 4.0. Every other version is fine, including the ipad. Any thoughts?

Thanks.

like image 603
user396004 Avatar asked Jul 16 '10 21:07

user396004


1 Answers

Seems to be a bug. I also had the Problem on iPad with iOS 3.2.

Solution:

a) Check your app state: In iOS 4 just use

[UIApplication sharedApplication].applicationState

Older iOS: Store your app state manually:

-(void)applicationWillResignActive:(UIApplication *)application
{
    self.appIsInBackground = YES;
}

-(void)applicationWillTerminate:(UIApplication *)application
{
    self.appIsInBackground = YES;
}

-(void)applicationDidBecomeActive:(UIApplication *)application
{
    // Open your UIAlert here if self.appIsInBackground == YES;

    self.appIsInBackground = NO;
}

b) open the UIAlert after the app did become active, as shown above in the comments.

like image 178
Obiwahn Avatar answered Oct 21 '22 17:10

Obiwahn