Three20 - 将 TTTableViewController 设置为 TableBannerView 时获取空 TableView
我有一个 TTTableViewController 并想要显示一个 tableBannerView (如图所示 在示例代码中)。要显示的视图又是一个 TTTableViewController:
- (void)toggleInfo {
if(self.tableBannerView) {
[self setTableBannerView:nil animated:YES];
} else {
CanteenInfoViewController *infoViewController = [[CanteenInfoViewController alloc] initWithCanteenID:[_canteen canteenID]];
[self setTableBannerView:infoViewController.view animated:YES];
[infoViewController release];
}
}
但是,当调用 [selftoggleInfo]
时,显示的 tableBannerView 是空的(我已经检查过 [infoViewController createModel]
和 < code>[infoViewController viewWillAppear:] 被调用)。 以模态方式呈现 infoViewController 时 ([selfpresentModalViewController:infoViewControlleranimated:YES];
),它会正确显示。
谁能给我提示我所缺少的东西吗?
谢谢, 蒂洛
I have a TTTableViewController and want to show a tableBannerView (as shown in the sample code). The view to show is again a TTTableViewController:
- (void)toggleInfo {
if(self.tableBannerView) {
[self setTableBannerView:nil animated:YES];
} else {
CanteenInfoViewController *infoViewController = [[CanteenInfoViewController alloc] initWithCanteenID:[_canteen canteenID]];
[self setTableBannerView:infoViewController.view animated:YES];
[infoViewController release];
}
}
However, when calling [self toggleInfo]
, the tableBannerView that is shown is empty (I already checked that [infoViewController createModel]
and [infoViewController viewWillAppear:]
are called).
When presenting infoViewController modally ([self presentModalViewController:infoViewController animated:YES];
), it is shown correctly.
Can anyone give me a hint on what I'm missing?
Thanks,
Tilo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯...您创建 infoViewController...将其视图设置为横幅视图...这可能会增加视图保留计数,但是随后您释放控制器,这会导致控制器被破坏(其保留计数没有增加2),在没有控制器的情况下留下它的视图......你确定这就是你想要的吗?
Uhm... you create the infoViewController... set it's view as banner view... which probably increases the views retain count, but then you release the controller which results in a destruction of the controller(its retain count wasn't raised to 2), leaving it's view behind without a controller... are you sure that's what you want?