首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

创办没有按钮的UIAlertView

2012-09-04 
创建没有按钮的UIAlertView默认的UIAlertView都有一个或者多个按钮,如果你想创建没有按钮的UIAlertView,可

创建没有按钮的UIAlertView

默认的UIAlertView都有一个或者多个按钮,如果你想创建没有按钮的UIAlertView,可以使用以下方法:

?

UIAlertView *alert;alert = [[[UIAlertView alloc] initWithTitle:@"\r\rConfiguring Preferences\rPlease Wait..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];[alert show];

?

如果你还想给UIAlertView添加一个等待提示符,则可以这么做:

?

UIAlertView *alert;alert = [[[UIAlertView alloc] initWithTitle:@"\r\rConfiguring Preferences\rPlease Wait..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];[alert show];UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);[indicator startAnimating];[alert addSubview:indicator];[indicator release];

?

因为这个UIAlertView没有按钮,所以就不能通过点击按钮将这个提示框去掉。可以通过程序的方式,将这个窗口关掉。

?

[alert dismissWithClickedButtonIndex:0 animated:YES];

?

热点排行