Hide bar button (both left and right) from another ViewController?

I've two ViewController from first i've added two bar buttons to second ViewController. code here- `

self.navigationItem.leftBarButtonItem =
[[[UIBarButtonItem alloc]
  initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
  target:self
  action:@selector(backBtnAction)] autorelease];
self.navigationItem.rightBarButtonItem =
[[[UIBarButtonItem alloc]
  initWithBarButtonSystemItem:UIBarButtonSystemItemDone
  target:callListViewCtrObj
  action:@selector(saveListNameAction)] autorelease];
self.navigationItem.rightBarButtonItem.tintColor = [UIColor blueColor];` 

Now i want to remove these two buttons when done button clicked(i.e. saveListNameAction of callListViewCtrObj is called, see the code above), i've tried like this- homeViewCtrObj.navigationItem.leftBarButtonItem = nil; homeViewCtrObj.navigationItem.rightBarButtonItem =nil; where homeViewCtrObj is object of first view controller.

Any suggestion or sample code will be appreciated. Thanks.

Answers


In CallListViewCtr create a property for HomeViewCtr

@property (nonatomic, assign) HomeViewCtr *homeView;

Now when you push this view makes sure to assign the newly created viewController to this property.

self.homeView = theNewViewControllerImAboutToPush;

Now you can use

self.homeView.navigatioItem.leftBarButtonItem = nil;
self.homeView.navigatioItem.rightBarButtonItem = nil;

I think you'll want to set homeView to nil when your done.


Need Your Help

Detecting modifier keys held down during startup in OS/X (or Windows)?

c++ windows osx juce

I've searched here and not found any question that really covers this.

Tortoise HG (mercurial) notification of pushed changes

mercurial tortoisehg

Is there any option or extension/tool to inform you if someone else has pushed changes to a central mercurial server? I often find that someone has pushed changes for a bug fix but I don't know un...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.