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

作者:朱克锋

邮箱:[email protected]

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


实例截图

IOS 带指示器的用户提示实例_第1张图片

@interface TestViewController : UIViewController <UIAlertViewDelegate>

{

UIAlertView *baseAlert;

}

@end


@implementation TestViewController

- (void) dismiss

{

    [baseAlert dismissWithClickedButtonIndex:0 animated:NO];

}


- (void) action: (UIBarButtonItem *) item

{

    baseAlert = [[[UIAlertView alloc] initWithTitle:@"请稍后。。。" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];

    [baseAlert show];


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

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

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

[aiv startAnimating];

[baseAlert addSubview:aiv];

[aiv release];


// 3s后自动消失

[self performSelector:@selector(dismiss) withObject:nil afterDelay:3.0f];

}

你可能感兴趣的:(IOS 带指示器的用户提示实例)