2012-04-17 4 views
0

스 와이프 때 경고 확인을하고 tableview에서 삭제 버튼을 클릭하십시오. 는 기본적으로 나는 데이터를 전송하기 전에 버튼을 "취소" "확인"에 경고 팝업을 보여 싶어 :삭제 Tableview에서 알림 확인

[[ConnectionSingleton getInstance] sendData:[NSString stringWithFormat:@"modifOrderFoodState::%@::%@::%@", [cellOrder objectForKey:@"orderFoodRelId"], state, [ConnectionSingleton getInstance].restaurantId] ]; 

을하고 경우 전송 데이터 기능 abord 취소 버튼의 클라이언트 클릭합니다.

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 

NSMutableDictionary *cellOrder = [orders objectAtIndex:indexPath.row]; 
NSString *state = @"4"; 

if (editingStyle == UITableViewCellEditingStyleDelete) { 


    [[ConnectionSingleton getInstance] sendData:[NSString stringWithFormat:@"modifOrderFoodState::%@::%@::%@", 
               [cellOrder objectForKey:@"orderFoodRelId"], 
               state, 
               [ConnectionSingleton getInstance].restaurantId] ]; 
    }  
} 

감사

답변

1

이 클래스 A UIAlertViewDelegate 확인 :

이 내 코드입니다. 스타일이 삭제 될 때 UIAlertView를 만듭니다. alertView : clickedButtonAtIndex : 메소드로 데이터 코드 전송을 이동하고 사용자가 확인을 클릭하면이를 실행하십시오.

+0

고마워요.하지만 이전에 가지고 있던 index.path.row 요소에 문제가 있습니다. 현재 행 색인을 얻는 방법은 무엇입니까? – socrateisabot

+0

행을 객체의 속성으로 저장하거나 cellOrder를 속성으로 만든 다음 경고를 표시 할 수 있습니다. (또는 테이블 뷰에서 indexPathForSelectedRow를 호출하십시오.) –