删除plist中的数据时显示alertview

时间:2011-08-25 05:06:16

标签: ios xcode core-data

我想使用plist删除UITableView中的数据,我想在按下删除按钮时放置alertview。我想提一下,我使用了编辑按钮从tableview中删除数据。编辑按钮的代码如下:为了您的信息。

 self.navigationItem.leftBarButtonItem=self.editButtonItem;

Plz帮我解决了这个问题。

提前完成。

2 个答案:

答案 0 :(得分:3)

在你的函数中写:

     UIAlertView    *alertView = [[UIAlertView alloc] initWithTitle: @"" message: @"" delegate: self cancelButtonTitle: @"OK" otherButtonTitles: nil];
alertView.tag = 1;
        [alertView show];
        [alertView release];

按下警告“确定”按钮

  - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
        { 
    if(buttonIndex==0)
        {
    if (alertView.tag == 1)
        {
    //Do your code
    }
   }
 }

希望它有所帮助...

答案 1 :(得分:1)

关于你的按钮动作写: -

-(IBAction)btnPressed
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil,nil];
    [alert show];
    [alert release];
}
- (void)alertView:(UIAlertView *)alert didDismissWithButtonIndex:(NSInteger)buttonIndex
{
}