我实现了 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/