iOS中UIAlertView警告框组件的使用教程

2020-01-15 15:04:09于丽

                                                 delegate:nil  

                                                 cancelButtonTitle:nil

                                                 otherButtonTitles:nil]; 

[alert show];

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

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

[activeView startAnimating]; 

[alert addSubview:activeView]; 

[activeView release]; 

[alert release];  

 

6. 其他  
UIAlertView默认情况下所有的text是居中对齐的。 那如果需要将文本向左对齐或者添加其他控件比如输入框时该怎么办呢? 不用担心, iPhone SDK还是很灵活的, 有很多delegate消息供调用程序使用。 所要做的就是在

复制代码
(void)willPresentAlertView:(UIAlertView *)alertView
中按照自己的需要修改或添加即可, 比如需要将消息文本左对齐,下面的代码即可实现:
复制代码
-(void) willPresentAlertView:(UIAlertView *)alertView

 

{

      for( UIView * view in alertView.subviews )