我有一个UIView(320 * 300的UIViewController视图),我希望显示UINaviationCotroller并控制此视图大小内的导航。
有可能吗?
由于
InterDev中
答案 0 :(得分:0)
答案 1 :(得分:0)
下面你会找到一个代码片段。但是,让我告诉你一句智慧。 不要这样做。不惜一切代价避免。 Apple不建议这样做。你将做噩梦,并将忙于修补边缘情况。它在3.x中运行良好,在iOS 4中你必须解决很多特殊情况。
- (void) _adjustViewControllerforTicker {
TickerView* vv = [ApplicationContext getTickerView];
if ([PreferenceDataModel isTickerOn]&& self.navigationController.view.frame.origin.y==0) {
CGRect tableRect = self.tableView.frame;
self.tableView.frame = CGRectMake(tableRect.origin.x,tableRect.origin.y, tableRect.size.width, tableRect.size.height -20);
UINavigationController *nav = self.navigationController;
CGRect gframe = CGRectOffset(self.navigationController.view.frame, 0, 20);
self.navigationController.view.frame = gframe;
if (!vv) {
vv = [[TickerView alloc] initWithFrame:CGRectMake(0, 0, 480, 20)];
[nav.view addSubview:vv];
[vv release];
self.tableView.contentInset=UIEdgeInsetsMake(0,0,20.0,0.0);
}
}
if (![PreferenceDataModel isTickerOn]) {
self.tableView.contentInset= UIEdgeInsetsZero;
if (vv){
[vv removeFromSuperview];
vv=nil;
}
}
}