ios - 侧边菜单 revealcontroller 问题与 UITableViewController

标签 ios objective-c xcode

我实现了 SWRevealController在我的申请中。它有两个 segue,一个用于 slideviewcontroller 和 viewcontroller。

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

最佳答案

您可以在 tableview 的委托(delegate)方法中实现您的 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 .

关于ios - 侧边菜单 revealcontroller 问题与 UITableViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24164011/

相关文章:

iphone - 如何从 UITableViewCell 中删除背景图像?

ios - 如何在当前位置绘制图钉注释,MapKit,Swift,iOS10

iphone - UIAlertViewDelegate 和更多警报窗口

iphone - 从 ViewController 返回 View

iPhone 4 根据 GPS 纬度和一年中的某一天以编程方式计算日持续时间

ios - 容器 View 集合 VC 被父级的点击手势识别器阻止

ios - 了解EAGLView

ios - 带有 RKXMLReaderSerialization 和 XMLReader 的 RestKit 0.20-pre3

iphone - 如何在 Mac OSX 10.6.4 Snow leopard 中使用 iOS 5 安装 xcode 4.2

ios - 通过弹出 navigationController 或使用选项卡栏来识别是否到达 viewController 的更好方法