2011-08-25 51 views
0

我想使用plist刪除UITableView中的數據,並且我想在按下刪除按鈕時放置alertview。我想提一提的是我使用編輯按鈕從tableview中刪除數據。編輯按鈕的代碼如下:供您參考。在plist中刪除數據時顯示警報視圖

self.navigationItem.leftBarButtonItem=self.editButtonItem; 

Plz幫我解決了這個問題。

thanx提前。

+0

你是否提供了浸泡警報視圖的代碼 – Gypsa

回答

3

在你的函數寫:

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

在警報 「OK」 按鈕按下

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

希望它可以幫助...

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 
{ 
} 
+0

thanx尋求幫助。 – iPhone