tombenner / nui

Style iOS apps with a stylesheet, similar to CSS
MIT License
3.76k stars 461 forks source link

UIBarButtonItem doesn't appear to be styled #125

Closed powerje closed 7 years ago

powerje commented 11 years ago

I was trying out the provided Route theme:

image

I'm using a Storyboard and have a UITableViewController. When I enable the edit button like so:

self.navigationItem.rightBarButtonItem = self.editButtonItem;

It looks like this: screen shot 2013-05-24 at 2 56 17 pm

Instead of the way the styled UIBarButtonItem looks in the Route screen shot.

pedro380085 commented 11 years ago

In this case, you can call + (void)renderBarButtonItem:(UIBarButtonItem*)item, so the code stays like that:

self.navigationItem.rightBarButtonItem = self.editButtonItem;
[NUIRenderer renderBarButtonItem:self.editButtonItem];
rcabamo commented 11 years ago

I have a similar error with automatic back button in navigation Controller, any idea how I can solve this?

Thanks :)

https://github.com/tombenner/nui/issues/123

powerje commented 11 years ago

Thanks @pedro380085, that worked perfectly!

Is this something that should be considered a bug, or is using NUIRenderer directly the expected way to do this?

btw @rcabamo, I pushed onto my nav controller in the screen shot above and my back button was styled appropriately. I'll download the sample project linked to your issue and see if I can help though.

pedro380085 commented 11 years ago

@powerje I believe it is not a feature, that's because UIBarButtonItem is a very strange class, it doesn't even inherits from UIView! I expect to see a better support for it on the future, but setting it programmatically is not a big deal.

powerje commented 11 years ago

This seems to affect more than just TabBarItems, I added:

View { background-color: #ECE7E4; }

to my theme and it changes nothing. But if I then in viewDidLoad for a given VC manually [NUIRenderer renderView:self.view]; it works.