通过键盘显示视图 [英] Show a view over the keyboard

查看:110
本文介绍了通过键盘显示视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于定制的加载子视图,我在iPhone上寻找一种方法,让子视图覆盖键盘而不会解除键盘。现在当子视图加载时,键盘仍然是最顶层的。任何想法?

I am looking for a way on the iPhone, due to a custom 'loading' subview, to have a subview cover the keyboard without dismissing the keyboard. Right now when the subview loads, the keyboard is still topmost. Any ideas?

推荐答案

在窗口上添加加载视图作为子视图。它也将涵盖键盘。这是一个相同的stackoverflow帖子

add your loading view as subview on window. It will cover keyboard too. Here is a stackoverflow post for the same

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

}

这篇关于通过键盘显示视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆