码迷,mamicode.com
首页 > 其他好文 > 详细

AlertView

时间:2015-01-15 00:12:09      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:

AlertView 的类型

 
  • UIAlertViewStyleDefault,
  • UIAlertViewStyleSecureTextInput,
  • UIAlertViewStylePlainTextInput,
  • UIAlertViewStyleLoginAndPasswordInput
 
@property(nonatomic,readonly) NSInteger numberOfButtons;
@property(nonatomic) NSInteger cancelButtonIndex;      // if the delegate does not implement -alertViewCancel:, we pretend this button was clicked on. default is -1
@property(nonatomic,readonly) NSInteger firstOtherButtonIndex;// -1 if no otherButtonTitles or initWithTitle:... not used
 
- (UITextField *)textFieldAtIndex:(NSInteger)textFieldIndex NS_AVAILABLE_IOS(5_0);
 

- (NSInteger)addButtonWithTitle:(NSString *)title;    // returns index of button. 0 based.
- (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;
 
代理方法
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
 
示例:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    NSString *buttonTitle = [alertView buttonTitleAtIndex:buttonIndex];
   
    if ([buttonTitle isEqualToString:[self cancelButtonTitle]]) {
        NSLog(@"User pressed the Cancel button");
    } else {
        NSLog(@"User pressed the Ok button");
    }
   
}
 

AlertView

标签:

原文地址:http://www.cnblogs.com/kangshang/p/4225021.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!