Re: [iPhone] UINavigationController and UINavigationBar
Re: [iPhone] UINavigationController and UINavigationBar
- Subject: Re: [iPhone] UINavigationController and UINavigationBar
- From: Duccio <email@hidden>
- Date: Wed, 09 Dec 2009 02:02:20 +0100
Il giorno 09/dic/2009, alle ore 01.49, Luke the Hiesterman ha scritto:
>>
>> So, just to understand, why can I do that through IB but not (legally) via code? The ability to choose a class for the navigation bar in a navigation controller should have been blocked in IB?
>>
>> You says about change Navigation Bar class to my subclass in IB "recommend avoiding even using this approach in IB", why? Should I read this in documentation or I would have inferred by readonly navigationBar property (because next time I would not ask the list similar question/problem)?
>>
>> I started working with Cocoa Touch a few days ago and I will not only learn the techniques but also best practices, philosophy and so on...
>
> Yes, the readonly is the key. Using IB to set the class of the navBar can be thought of as a sort of work-around to the issue that a readonly property isn't meant to be directly changed. Note, though, that you can safely modify writeable properties of a readonly property. Example:
>
> UINavigationController has a navigationBar property, which is readonly, so you can't change it, but...
> UINavigationBar has a tintColor property which IS writeable, so while you can't provide a different navigationBar, you can modify some properties of the bar itself.
>
Yes, I know, but no backgroundImage property :-) And Apple documentations says, for example: "It is permissible to modify the barStyle or translucent properties of the navigation bar but you must never change its frame,bounds, or alpha values directly." so very restrictive...
> Hope that helps, and I wish you the best writing great iPhone code!
>
Many thanks for the tips and the good wishes
> Luke
Duccio
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden