2014-09-10 1 views
0

현재 변경하려는 경고 단추가 있습니다. 그 안에 들어가려면 셀을 클릭하는 대신 단추를 사용하고 싶습니다. 당신이 경고보기에서 클릭으로 새 컨트롤러를 밀어 의미하는 경우화면을 열려면 경고 단추를 변경하십시오.

- (void)tableView:(UITableView *)tableView 
    didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    BNRDetailViewController *detailViewController = 
           [[BNRDetailViewController alloc] init]; 

    // Push it onto the top of the navigation controller's stack 
    [self.navigationController pushViewController:detailViewController 
             animated:YES]; 
} 
+0

표시되는 경고보기에서 단추를 사용하려는 경우 취소 단추를 추가하고 클릭 한 경고보기 단추를 처리하기 위해 UIAlertViewDelegate를 구현해야합니다. 버튼 클릭을 처리하는 메소드에서 BNRDetailViewController를 초기화하고 푸시 할 수 있습니다. [alertView : didDismissWithButtonIndex :] (https://developer.apple.com/library/ios/documentation/uikit/reference/UIAlertViewDelegate_Protocol/UIAlertViewDelegate/UIAlertViewDelegate.html#//apple_ref/doc/uid/TP40007548-CH3-SW1)입니다. 구현하고 싶은 UIAlertViewDelegate 메소드 – trevorj

답변

0

, 당신은 UIAlertViewDelegate과 메시지를 추가해야합니다 :

- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index 
{ 
    switch (index) { 
     case 0: 

    { 
     NSLog(@"More button was pressed"); 
     UIAlertView *alertTest = [[UIAlertView alloc] initWithTitle:@"Hello" message:@"More more more" delegate:nil cancelButtonTitle:@"cancel" otherButtonTitles: nil]; 
     [alertTest show]; 

     [cell hideUtilityButtonsAnimated:YES]; 
     break; 
    } 

어떻게이와 있음을 통합 할 수 있습니다 알림보기의 다른 버튼 당신은 사용자가 대신 경고보기를 표시하는의 ViewController를 밀어있는 tableview 행을 스 와이프 할 때 드러난다 버튼을 원하는 것을 의미하는 경우 그 다음 clickedButtonAtIndex 방법

-(void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex 
{ 


if (buttonIndex == [alertView firstOtherButtonIndex] && [alertview.title isEqualToString:@"Hello"]) { 


    [self.navigationController pushViewController:detailViewController 
            animated:YES]; 

    } 
} 
1

전화, 이것은 당신이 원하는 무엇인가 :

- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index 
{ 
    switch (index) { 
     case 0: 

    { 
     BNRDetailViewController *detailViewController = [[BNRDetailViewController alloc] init]; 

     // Push it onto the top of the navigation controller's stack 
     [self.navigationController pushViewController:detailViewController 
            animated:YES]; 

     [cell hideUtilityButtonsAnimated:YES]; 
     break; 
    } 
관련 문제