【问题标题】:Storyboard to a nib故事板到笔尖
【发布时间】:2012-03-29 03:28:30
【问题描述】:

我在RSS 987654321 RSS时,它在选择一个行时按下详细信息视图。我让它在使用 Nib 文件的旧 UI 格式下运行良好,但我想将所有内容传输到 UIStoryboard。我了解到UIStoryboards 和nibs 是兼容的,所以我决定保留相同的代码,但将UITableView 放在UIStoryboard 中,并让详细视图成为它自己的笔尖。我把所有东西都联系起来了,它应该可以工作,它没有给我任何错误,但它没有。有什么我错过的,或者故事板和笔尖根本不兼容。

编辑:

- (id)initWithItem:(NSDictionary *)theItem {
    if (self == [super initWithNibName:@"RssDetailController" bundle:nil]) {
        self.item = theItem;
        self.title = [item objectForKey:@"title"];
    }

    return self;
}

【问题讨论】:

  • “它不起作用”对您的问题没有帮助。但正如一个想法,我相信故事板调用的初始化程序是initWithCoder:。
  • 视图只是没有推送到detailviewcontroller。我只是想知道在将视图从情节提要转移到笔尖时是否需要放入任何东西。
  • 显示你正在推送细节视图控制器的代码。
  • 这不是推送代码。这是 RssDetailController 中的初始化。选择行后,应从表视图中调用推送。您是否将情节提要中的表格视图与其各自的类联系起来?

标签: objective-c ios xcode storyboard nib


【解决方案1】:

您是从UIStoryboard 中的UIViewController 推送到NIB 文件吗?

如果是这样,请查看从情节提要推送到 NIB 的 this sample project:

// in a navigation controller

// to load/push to new controller use this code

// this will be next screen
DetailsViewController *detailsViewController = [[DetailsViewController alloc ]init];
[self.navigationController pushViewController:detailsViewController animated:YES];


// to go back or pop controller use this
// now it will send back to parent screen
[self.navigationController popViewControllerAnimated:YES];

【讨论】:

    猜你喜欢
    • 2012-10-21
    • 2011-12-10
    • 1970-01-01
    • 2013-05-01
    • 2015-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-08
    相关资源
    最近更新 更多