【问题标题】:Error on didselect tableview on SWRevealViewControllerSWRevealViewController 上的 didselect 表视图错误
【发布时间】:2016-03-06 07:54:24
【问题描述】:

当我使用SWRevealViewController 类使用滑出菜单时,它在 iphone 模拟器中正常工作。但是当我尝试在 iphone 5 设备中运行进行测试时,在选择菜单按钮时,它会正确显示滑出菜单,但不幸的是,在选择单元格时,它崩溃并显示以下错误。但模拟器中没有此类错误。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    indexPath = [[self tableView] indexPathForSelectedRow];
    if (indexPath.row==0) {

        [self performSegueWithIdentifier:@"home" sender:indexPath];

    }
  else if (indexPath.row==1) {

        [self performSegueWithIdentifier:@"cartme" sender:indexPath];

    }
   else {

        [self performSegueWithIdentifier:@"changelocation" sender:indexPath];

    }
}

由于未捕获的异常而终止应用程序 'NSInvalidArgumentException',原因:'-[SWRevealViewControllerSegue setDestinationContainmentContext:]: 无法识别的选择器发送到 实例 0x175c5f90'

请帮帮我。

【问题讨论】:

  • 分享didSelectRowForIndexPath方法的代码。

标签: ios uitableview ios9 swrevealviewcontroller


【解决方案1】:

根据this iOS open source codes添加更多信息。

很明显,setDestinationContainmentContextpush segue 的一个方法。所以,自定义segue应该选择Custom segue类型,而不是Push

UIStoryboardSegue 的子类没有这样的方法,所以它崩溃了。

/* Generated by RuntimeBrowser
   Image: /System/Library/Frameworks/UIKit.framework/UIKit
 */

@interface UIStoryboardPushSegueTemplate : UIStoryboardSegueTemplate {
    int  _destinationContainmentContext;
    int  _splitViewControllerIndex;
}

@property (nonatomic) int destinationContainmentContext;
@property (nonatomic) int splitViewControllerIndex;

- (int)destinationContainmentContext;
- (void)encodeWithCoder:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (id /* block */)newDefaultPerformHandlerForSegue:(id)arg1;
- (void)setDestinationContainmentContext:(int)arg1;
- (void)setSplitViewControllerIndex:(int)arg1;
- (int)splitViewControllerIndex;

@end

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,我通过将 segue 类型更改为“自定义”而不是“推送”来修复它

    【讨论】:

      猜你喜欢
      • 2015-06-26
      • 1970-01-01
      • 2015-07-03
      • 2015-07-01
      • 2017-11-28
      • 2018-02-21
      • 2017-05-24
      • 2016-05-24
      • 2017-01-16
      相关资源
      最近更新 更多