From 4285aa1eb851981d15f249069c8b72d02810199e Mon Sep 17 00:00:00 2001 From: Stephan Diederich Date: Fri, 31 Aug 2012 15:02:51 +0200 Subject: [PATCH] fix update button state if the user has UINavigationButton's text attributes customized iOS 6 beta 4 calls viewWillAppear if a navigationButton is set on the navigationItem in viewDidLoad (rdar://12214613) As BITUpdateViewController thinks the view was already loaded in viewWillAppear, the button state is not properly set. Setting the navigationButton in init fixes this. --- Classes/BITUpdateViewController.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Classes/BITUpdateViewController.m b/Classes/BITUpdateViewController.m index 8f53b4c023..4a64cceea9 100644 --- a/Classes/BITUpdateViewController.m +++ b/Classes/BITUpdateViewController.m @@ -209,6 +209,14 @@ _cells = [[NSMutableArray alloc] initWithCapacity:5]; _popOverController = nil; + + //might be better in viewDidLoad, but to workaround rdar://12214613 and as it doesn't + //hurt, we do it here + if (self.modal) { + self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone + target:self + action:@selector(onAction:)] autorelease]; + } } return self; } @@ -356,12 +364,6 @@ self.tableView.tableHeaderView = _appStoreHeader; - if (self.modal) { - self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self - action:@selector(onAction:)] autorelease]; - } - PSStoreButton *storeButton = [[[PSStoreButton alloc] initWithPadding:CGPointMake(5, 40)] autorelease]; storeButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; storeButton.buttonDelegate = self;