5
votes

i am unzipping a file on background thread and i am calling HomeViewController on main thread.in this view controller i have a UIBarButtonItem on UINavigationBar. if i click this button it goes to StoryViewController and the unzipped data is used there. so i want to show the Home view Controller though the unzipping process is not completed, for that i have to hide the button on the navigation bar when the unzipping starts on backround thread and after completion of the upzipping again i have to show the button on navigation bar. i am calling the methods of homeViewController to hide and show.. What i have to write in those methods..? i mean how to hide and show the uiBarButtonItem on UINavigationBar....?

Thanks....

2
Try not to put the same question twice and create duplicates.Parth Bhatt

2 Answers

18
votes

Once you have created your UIBarButtonItem say "myButton", you can add/remove it to your navigation controller using in your view Controller:

if(show)
    self.navigationItem.leftBarButtonItem = myButton;
else
    self.navigationItem.leftBarButtonItem = nil;