iOS 7 detail layout when master has navigation bar prompt

混江龙づ霸主 提交于 2019-12-07 07:46:13

问题


I run into a layout problem in iOS 7:

To reproduce create a simple master-detail-app and insert this line in MasterViewController.m :

self.navigationItem.prompt = @"Master";

and this in DetailViewController.m :

self.edgesForExtendedLayout = UIRectEdgeNone;

Both lines in viewDidLoad.

The detail view's frame does not update correctly when the navigation bar shrinks to its normal size.

How should I fix this?


回答1:


My current solution to this is to remove the prompt in the master view's viewWillDisappear:

- (void) viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.navigationItem.prompt = nil;
}

Then just set it again in the viewWillAppear. There should be a better method, however.



来源:https://stackoverflow.com/questions/18782205/ios-7-detail-layout-when-master-has-navigation-bar-prompt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!