UIAlertView
UIAlertView的使用實現(xiàn)指示器效果
- (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;
}
}
}