在iPhone应用程序中等待光标 [英] Wait cursor in an iPhone app

查看:37
本文介绍了在iPhone应用程序中等待光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种简单的方法可以在iPhone SDK中显示等待动画.我有一个加载屏幕需要几秒钟的屏幕,我想向用户提供一些正在发生的反馈.有什么建议吗?

Is there an easy way to display a wait animation in the iPhone sdk. I have a screen that will take a few seconds to load, and I'd like to give the user some feedback that something is happening. Any suggestions?

推荐答案

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];

会成功的!

编辑:在一个较旧的项目中发现了此内容,客户要求该指示器具有更好的可视性:

edit: Found this one in an older project, client requested an indicator with better visibility:

-(void)invokeMegaAnnoyingPopup
{
    self.megaAlert = [[[UIAlertView alloc] initWithTitle:@"Please wait..."
        message:nil delegate:self cancelButtonTitle:nil
        otherButtonTitles: nil] autorelease];

    [self.megaAlert show];

    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]
        initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

    indicator.center = CGPointMake(self.megaAlert.bounds.size.width / 2,
                                   self.megaAlert.bounds.size.height - 45);
    [indicator startAnimating];
    [self.megaAlert addSubview:indicator];
    [indicator release];
}

-(void)dismissMegaAnnoyingPopup
{
    [self.megaAlert dismissWithClickedButtonIndex:0 animated:YES];
    self.megaAlert = nil;
}

您当然需要在类中定义的 UIAlertView * megaAlert; .

You would of course need a UIAlertView *megaAlert; defined in your class.

这篇关于在iPhone应用程序中等待光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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