Я новичок в программировании iOS
, и у меня есть вопрос относительно UIAlertViews
в качестве темы.UIAlertView внутри UIAlertView
У меня есть кнопка для удаления записей в SQLite DB
. Эти кнопки вызывают UIAlertview
, чтобы предоставить пользователю несколько разных параметров при удалении записей.
- (IBAction)deleteFunction:(id)sender {
UIAlertView *delChoice = [[UIAlertView alloc] initWithTitle:@"Select from below." message:@"WARNING!:You are about to remove records. This is irreversible." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Delete Completed jobs",@"Delete All records",@"Select items to delete.", nil];
[delChoice show];
}
Вот следующий метод
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *title =[alertView buttonTitleAtIndex:buttonIndex];
if([title isEqualToString:@"Delete All records"]){
[database executeUpdate:@"delete from issues"];
if([database lastErrorCode]!=NULL){
UIAlertView *unconfirm = [[UIAlertView alloc]initWithTitle:@"Failure!" message:@"Something went wrong. Try one more time." delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[unconfirm show];
}else {
UIAlertView *confirm = [[UIAlertView alloc]initWithTitle:@"Success!" message:@"All records have been removed." delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil];
[confirm show];
}
}
Это не полный метод. Мой вопрос заключается в том, что внутри вложенного uialertview (unconfirm and confirm), если я решил добавить «otherButtonTitles», как я могу ответить на них? Неужели я делаю то же самое, что и в том же основном методе?
Также, если есть лучший способ сделать это, я был бы признателен за указатели!
soz, этот ответ действительно не отвечает на мой вопрос = P – Juznut