UIAlertView
UIAlertView的使用实现指示器效果
- (void)useAlertView
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"警告" message:@"是否要删除它?" delegate:self cancelButtonTitle:@"是" otherButtonTitles:@"否", nil];
alertView.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
alertView.tag = 999; // 一般要作标记,在clickedButtonAtIndex中根据tag作不同的处理
[alertView show];
}
#pragma mark - <UIAlertViewDelegate>
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1) {
if (alertView.tag == 999) {
NSLog(@"点击了第%zd个按钮 - %@", buttonIndex, [alertView textFieldAtIndex:0].text);
return;
}
}
}