How to add a Category only for iPhone at universal project
I Have a iOS Universal Project, and Change The UINavigationBar Background开发者_JS百科 By Category (Ref:http://stackoverflow.com/questions/1692487/how-to-add-background-image-on-iphone-navigation-bar)
After that, I found the Category changed the iPhone and iPad app, the question is ,how can I only change the iPhone App Navigation Bar background image, and the iPad app use the default background image?
You could base your code around a conditional [[UIDevice currentDevice] userInterfaceIdiom]
. This property of UIDevice returns an enum value indicating whether the device the app is running on is an iPhone/iPod touch device or an iPad device.
In the case that this property returns UIUserInterfaceIdiomPhone, then you could use your custom background image your category method's implementation.
精彩评论