在静态库(lib.a)中,我NavigationController在 Storyboard 中有一个在点击按钮后启动的:
[mainWindow.rootViewController presentViewController:newController animated:NO completion:Nil];
在其中newController我有一个UITextField我设置becomeFirstResponder的viewDidLoad按钮和另一个按钮,当我点击它时我想显示一个UIAlertView,在按下“确定”后应该UIActivityIndicatorView在所有东西(包括键盘)的顶部显示一个。
用于显示的代码UIActivityIndicatorView如下
UIWindow *mainWindow = [[UIApplication sharedApplication] keyWindow];
spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
spinner.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleBottomMargin);
spinner.center = CGPointMake(CGRectGetWidth(mainWindow.bounds)/2, CGRectGetHeight(mainWindow.bounds)/2);
spinner.frame = mainWindow.bounds;
spinner.backgroundColor = [UIColor darkGrayColor];
spinner.alpha = 0.7f;
[mainWindow addSubview:spinner];
每当用户点击按钮时,我都会执行以下操作:
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Confirmation"
message:@"Are you sure?"
delegate:self
cancelButtonTitle:@"No"
otherButtonTitles:@"Yes", nil];
[message show];
当被点击时,我有一个简单的方法:
//Initializing spinner
[spinner startAnimating];
//Execute NSURL Connection....
问题是UIActivityIndicatorView键盘顶部没有显示。
有任何想法吗?