Показать вид на клавиатуру - PullRequest
6 голосов
/ 01 июля 2011

Я ищу способ для iPhone, благодаря настраиваемому подпредставлению «загрузка», чтобы подпункт покрывал клавиатуру, не отмахиваясь от нее.Прямо сейчас, когда загружается подпредставление, клавиатура все еще верхняя.Есть идеи?

Ответы [ 3 ]

18 голосов
/ 08 декабря 2011
@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];
13 голосов
/ 02 июня 2014
UIWindow *window = [UIApplication sharedApplication].windows.lastObject;
[window addSubview:self.view];                                                                                                                                                                                                                                        
[window bringSubviewToFront:self.view];
7 голосов
/ 01 июля 2011

добавить ваш вид загрузки в качестве подпредставления на окне.Это также покроет клавиатуру.Вот сообщение стека переполнения для того же

IPhone - Показать индикатор ожидания

ОБНОВЛЕНИЕ

Мой код

#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];

}
...