IOS 带指示器的用户提示实例

来源:互联网 发布:可变数据印刷软件价格 编辑:程序博客网 时间:2024/04/30 11:34

作者:朱克锋

邮箱:zhukefeng@iboxpay.com

转载请注明出处:http://blog.csdn.net/linux_zkf


实例截图


@interface TestViewController :UIViewController <UIAlertViewDelegate>

{

UIAlertView *baseAlert;

}

@end


@implementation TestViewController

- (void) dismiss

{

    [baseAlertdismissWithClickedButtonIndex:0animated:NO];

}


- (void) action: (UIBarButtonItem *) item

{

    baseAlert = [[[UIAlertViewalloc] initWithTitle:@"请稍后。。。" message:nildelegate:selfcancelButtonTitle:nilotherButtonTitles: nil]autorelease];

    [baseAlertshow];


//创建并添加一个活动指示器 

UIActivityIndicatorView *aiv = [[UIActivityIndicatorViewalloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

aiv.center =CGPointMake(baseAlert.bounds.size.width /2.0f, baseAlert.bounds.size.height -40.0f);

[aiv startAnimating];

[baseAlertaddSubview:aiv];

[aiv release];


// 3s后自动消失

[selfperformSelector:@selector(dismiss)withObject:nilafterDelay:3.0f];

}

原创粉丝点击