ActionSheet 打开一个 显示在 UIWindow上的弹出框,弹出框显示了一下马上又消失了呢?
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
NSArray *windowViews = [window subviews];
if(windowViews && [windowViews count] > 0)
{
UIView *subView = [windowViews objectAtIndex:[windowViews count]-1];
for(UIView *aSubView in subView.subviews)
{
[aSubView.layer removeAllAnimations];
}
[subView addSubview:self];
[self showBackground];
[self showAlertAnimation];
}
}
搞定了 修改上面的一行代码即可AppDelegate *app = [UIApplication sharedApplication].delegate;
UIWindow *window = app.window;
弹出框的show 方法:
- (void)show
{UIWindow *window = [[UIApplication sharedApplication] keyWindow];
NSArray *windowViews = [window subviews];
if(windowViews && [windowViews count] > 0)
{
UIView *subView = [windowViews objectAtIndex:[windowViews count]-1];
for(UIView *aSubView in subView.subviews)
{
[aSubView.layer removeAllAnimations];
}
[subView addSubview:self];
[self showBackground];
[self showAlertAnimation];
}
}
搞定了 修改上面的一行代码即可AppDelegate *app = [UIApplication sharedApplication].delegate;
UIWindow *window = app.window;