标签:
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