1

スタティック ライブラリ (lib.a) 内NavigationControllerに、ボタン タップ後に開始する Storyboard があります。

[mainWindow.rootViewController presentViewController:newController animated:NO completion:Nil];

その中newControllerには、UITextField設定becomeFirstResponderしたものviewDidLoadと、タップしたときに表示したい別のボタンがUIAlertViewあり、「OK」を押すと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がキーボードの上に表示されないことです。

何か案は?

4

2 に答える 2

0

UIActivityIndicatorViewインジケータを表示する前に、 をウィンドウの最前面のサブビューに設定します

コードを追加:[mainWindow bringSubviewToFront:spinner];前に[spinner startAnimating];

于 2013-02-21T02:09:14.827 に答える
0

後に追加してみてください

[mainWindow addSubview:spinner];

何かのようなもの

[mainWindow bringSubviewToFront:spinner];

このビューを UIActivityIndi​​catorView のスーパービューとして使用してみてください

- (UIView *)keyboardView {
    NSArray *windows = [[UIApplicatio sharedApplication] windows];
    for (UIWindow *window in [windows reverseObjectEnumerator]) {
        for (UIView *view in [window subviews]) {
            if (!strcmp(object_getClassName(view), "UIKeyboard"))  {
                return view;
            }
        }
    }

    return nil;
}
于 2013-02-20T20:44:10.663 に答える