所以我已经升级到iPad的代码(即转换为通用应用程序)。但是,iOS4的UIAlertview渲染似乎已关闭。它不是被放置在中间,而是跳起来并显示在上面,半框被切断。同样适用于横向。iphone到ipad,iphone 4 uialertview问题
这是我的理解,UIalertview始终设置在中间?我查看了代码,并没有在代码中的任何位置设置框架/位置。这只发生在4.0,iphone 4和运行4.0的itouch上。其他版本都很好,包括ipad。有什么想法吗?
谢谢。
所以我已经升级到iPad的代码(即转换为通用应用程序)。但是,iOS4的UIAlertview渲染似乎已关闭。它不是被放置在中间,而是跳起来并显示在上面,半框被切断。同样适用于横向。iphone到ipad,iphone 4 uialertview问题
这是我的理解,UIalertview始终设置在中间?我查看了代码,并没有在代码中的任何位置设置框架/位置。这只发生在4.0,iphone 4和运行4.0的itouch上。其他版本都很好,包括ipad。有什么想法吗?
谢谢。
似乎是一个错误。我在iOS 3.2上也遇到了这个问题。
解决方案:
a)检查您的应用程序状态: 在iOS 4的只是使用
[UIApplication sharedApplication].applicationState
旧的iOS:手动存储您的应用程序状态:
-(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)打开UIAlert在应用程序确实激活之后,如上面的评论所示。
您的警报是否添加了任何文本框?
因为如果您在alertview中有文本字段,4.0+ iOS会将alertview滚动到可见部分。
对于iPad 3.2,当应用程序退出活动状态时,我遇到同样的问题,此时警报显示警报将显示在左上角。所以我固定使用下面的代码的方法 - (空)applicationDidBecomeActive:(UIApplication的*)应用
//Check that key window is alert view
if ([[[UIApplication sharedApplication].keyWindow description] hasPrefix:@"<_UIAlertOverlayWindow"]) {
//Yes then check for subviews tht are alertViews
UIWindow *alertViewWindow = [UIApplication sharedApplication].keyWindow;
NSArray *subViews = [alertViewWindow subviews];
for (UIView *subview in subViews)
{
if ([subview isKindOfClass:[UIAlertView class]])
{
//Retain it
UIAlertView *alertView = (UIAlertView *)[subview retain];
//Now dismiss it and then show it again
[alertView dismissWithClickedButtonIndex:0 animated:NO];//Here ClickedButtonIndex must be according to cancel button
//Show the alert view again
[alertView show];
//Release previsous retained object
[alertView release];
}
}
}
那么你的创造是什么样子?你有一个标题和内容,或只有一个或另一个?我看到了这个相同的东西,最后不得不调整框架,所以你尝试移动框架? – AtomRiot 2010-07-16 22:35:39
我实际上正在为别人调试。通过创建,你的意思是分配和初始化?我认为它有一个标题和内容。我看着初始化并没有看到任何帧的使用。我会再检查一次。 好奇心,这只显示4.0而不是其他版本,只有在升级到通用后? – user396004 2010-07-16 22:59:26