Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7 detail layout when master has navigation bar prompt

I run into a layout problem in iOS 7:

Screenshot

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?

like image 519
Felix Avatar asked Oct 22 '22 01:10

Felix


1 Answers

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.

like image 193
dtim Avatar answered Nov 01 '22 18:11

dtim