ECSlidingViewController 和 UITableView

发布于 2025-01-05 03:58:02 字数 1326 浏览 1 评论 0原文

我正在尝试使用 https://github.com/edgecase/ECSlidingViewController 并使用其演示应用程序进行克隆,以 3 个 ViewController 开头。

我已成功在 FirstTopViewController 中实现了一个表格视图(这是启动应用程序时的默认视图),但我无法让 didSelectRowAtIndexPathMethod 打开包含有关触摸单元格详细信息的子视图。

我环顾四周,在 http://kurrytran 找到了一个示例应用程序。 blogspot.com/2011/10/ios-5-storyboard-and.html 关于如何准确地完成我想要做的事情(即在标准视图中实现表视图),但我不能找个理由为什么它不起作用。

由于 ECSliding 的工作方式,是否有什么特别的事情要做?选择一行时我使用的代码是

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

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
        storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
    } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
    }
    UIViewController *rowDetail = [storyboard instantiateViewControllerWithIdentifier:@"RowDetail"];
    [self.navigationController pushViewController:rowDetail animated:YES];
}

EDIT: self.navigationController is (null),所以我现在知道为什么它不起作用,还没有找到如何使其工作

谢谢!

I'm trying to use https://github.com/edgecase/ECSlidingViewController and cloned with its demo app, which starts with 3 ViewControllers.

I have successfully implemented a table view in the FirstTopViewController (which is the default view when you launch the app), except that I can't have didSelectRowAtIndexPathMethod open a sub view with details about the touched cell.

I looked around and found an example app at http://kurrytran.blogspot.com/2011/10/ios-5-storyboard-and.html on how to do exactly what I was trying to do (which is implement a table view inside a standard view), but I can't find a reason why it doesn't work.

Could there be anything special to do due to the way ECSliding works ? The code I use when a row is select is

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

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
        storyboard = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];
    } else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        storyboard = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];
    }
    UIViewController *rowDetail = [storyboard instantiateViewControllerWithIdentifier:@"RowDetail"];
    [self.navigationController pushViewController:rowDetail animated:YES];
}

EDIT: self.navigationController is (null), so I now know why it doesn't work, haven't found yet how to make it work

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悲念泪 2025-01-12 03:58:02

UINavigationController 应该与任何其他 UIViewController 一样工作。

确保将 topViewController 设置为 UINavigationController 实例,而不是其子视图控制器之一。

The UINavigationController should work the same as any other UIViewController.

Make sure that you are setting the topViewController to the UINavigationController instance, not to one of its child view controllers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文