|
|
#1 |
|
Changing the style of a bar button item
Let's say that I have a navigation controller and I push a view controller.By doing this, a button that leads me back to the previous controller is created.
I've found the navigation item holding the button this way: Code:
UINavigationItem* backItem=self.navigationController.navigationBar.topItem; But the only button is backItem.rightBarButtonItem, even if the button is displayed at the left, the other two buttons (back and right) are nil. If I try changing the button item this way: Code:
backItem.rightBarButtonItem.style= UIBarButtonItemStylePlain; |
|
|
|
0
|
|
|
#2 |
|
Try something like this:
Code:
UIBarButtonItem *previous = [[UIBarButtonItem alloc]
initWithTitle:@"Search"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(SearchAction:)];
__________________
Greetings from the Arctic Circle
|
|
|
|
0
|
|
|
#3 |
|
Is there a Reason setting.
yourViewController.navigationItem.backButtonItem = someButton; wouldn't work for you? If you do that to your viewControllers when you set them up, when you push the viewController on to the navigation controller the buttons will be those set for the visible viewController. You don't have to worry about reseting each time that view will appear.
__________________
There is no such thing as "Collective Wisdom" [13" MacBookPro 2.7Ghz, 27"Al iMac i7, Black MacBook 13", iPhone 4, iPad] |
|
|
|
0
|
|
|
#4 |
|
You must change the button before you push on the new view controller.
__________________
2.4 MacBook Aluminum 480GB SSD/750GB Optibay 8GB RAM CE | MacBook 2.4 SR 4GB, 320GB HD | PB G4 1.67 | 15 TiBook-DVI 800 iPhone 4S 16GB | iPhone 5 32GB
|
|
|
|
0
|
|
|
#5 |
|
I usually set a custom left or back button in viewDidLoad of the view controller that's been pushed.
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 05:18 AM.







Linear Mode
