カスタムの「読み込み」サブビューのために、キーボードを閉じずにサブビューでキーボードをカバーする方法をiPhoneで探しています。サブビューがロードされる現在、キーボードはまだ一番上にあります。何か案は?
14030 次
3 に答える
19
@interface UIApplication (Util)
- (void)addSubViewOnFrontWindow:(UIView *)view;
@end
@implementation UIApplication (Util)
- (void)addSubViewOnFrontWindow:(UIView *)view {
int count = [self.windows count];
UIWindow *w = [self.windows objectAtIndex:count - 1];
[w addSubview:view];
}
@end
UIApplication *app = [UIApplication sharedApplication];
[app addSubViewOnFrontWindow:_loadingView];
于 2011-12-08T03:22:42.683 に答える
13
UIWindow *window = [UIApplication sharedApplication].windows.lastObject;
[window addSubview:self.view];
[window bringSubviewToFront:self.view];
于 2014-06-02T17:33:42.213 に答える
7
読み込みビューをウィンドウのサブビューとして追加します。キーボードもカバーします。これは同じのstackoverflow投稿です
アップデート
私のコード
#pragma mark -
#pragma mark Waiting View
- (void)showWaitingView {
CGRect frame = CGRectMake(90, 190, 32, 32);
UIActivityIndicatorView* progressInd = [[UIActivityIndicatorView alloc] initWithFrame:frame];
[progressInd startAnimating];
progressInd.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
frame = CGRectMake(130, 193, 140, 30);
UILabel *waitingLable = [[UILabel alloc] initWithFrame:frame];
waitingLable.text = @"Processing...";
waitingLable.textColor = [UIColor whiteColor];
waitingLable.font = [UIFont systemFontOfSize:20];;
waitingLable.backgroundColor = [UIColor clearColor];
frame = [[UIScreen mainScreen] applicationFrame];
UIView *theView = [[UIView alloc] initWithFrame:frame];
theView.backgroundColor = [UIColor blackColor];
theView.alpha = 0.7;
theView.tag = 999;
[theView addSubview:progressInd];
[theView addSubview:waitingLable];
[progressInd release];
[waitingLable release];
[window addSubview:[theView autorelease]];
[window bringSubviewToFront:theView];
}
- (void)removeWaitingView {
UIView *v = [window viewWithTag:999];
if(v) [v removeFromSuperview];
}
于 2011-07-01T05:45:48.073 に答える