使用UITableViewController的Side Menu revealcontroller问题

时间:2014-06-11 13:19:12

标签: ios objective-c xcode

我在我的应用程序中实现了SWRevealController。它有两个segues,一个用于slideviewcontroller和viewcontroller。

我的slideviewcontroller是UITableViewController,我创建了一个新类MenuTableViewController,用作该siderbar(slideview)的自定义类。当我将MenuTableViewController添加为该视图的自定义类时,我在滑动菜单时不会显示它。如果我把它留空了,就会显示出来。 问题是我想在单击单元格时执行segue标识符或单击按钮,但我不知道在哪里实现它们。

1 个答案:

答案 0 :(得分:1)

您可以在tableview的委托方法中实现您的segue:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self performSegueWithIdentifier:@"YourSegueIdentifier" sender:self];
}

您可以根据该方法内部所选项目的indexPath来转换为正确的ViewController。然后实现你的:

 -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
 {
     if ([segue.identifier isEqualToString:@"YourSegueIdentifier"]) 
     {
      DestinatinoVCClass *destinationVC = (DestinatinoVCClass *)segue.destinationViewController;
      //here you can set any public properties of the destinationVC    
     }
 }

但总的来说,到目前为止,将SWRevealController实施到您的应用中的是一个完整的tutorial

相关问题