UIAlertView Confirmation Delete or Cancel
UIAlertView Confirmation Delete or Cancel
- Subject: UIAlertView Confirmation Delete or Cancel
- From: Steven Haas <email@hidden>
- Date: Fri, 10 Jul 2009 07:49:00 -0400
Below is the code from Apple's example application call SQLiteBooks.
What I was trying to do is simply create a UIAlertView, that asks the
user if they are sure they want to delete the book. I am not sure how
to incorporate this properly.
// Remove a specific book from the array of books and also from the
database.
- (void)removeBook:(Book *)book {
// Delete from the database first. The book knows how to do this
(see Book.m)
[book deleteFromDatabase];
[books removeObject:book];
}
- (void) alertDeleteConfirm:(UIAlertView *)alertDeleteConfirm
clickedButtonAtIndex:(NSInteger)buttonIndex
{
{
if (buttonIndex == 0)
{
// do nothing just cancel
}
if (buttonIndex == 1)
{
// delete action
}
}
}
- (void) UIAlertView *alertDeleteConfirm = [[UIAlertView alloc]
initWithTitle:@"Confirm Delete" message:@"Are you sure you want to
delete the book from the application?" delegate:self
cancelButtonTitle:@"Cancel" otherButtonTitles:@"Delete", Nil];
[alertDeleteConfirm show];
[alertDeleteConfirm release];
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden