Re: [iPhone] UINavigationController and UINavigationBar
Re: [iPhone] UINavigationController and UINavigationBar
- Subject: Re: [iPhone] UINavigationController and UINavigationBar
- From: Aldo Armiento <email@hidden>
- Date: Tue, 08 Dec 2009 21:00:54 +0100
Il giorno 08/dic/2009, alle ore 20.40, Luke the Hiesterman ha scritto:
> You could subclass UINavigationController.
>
I can't (or I should't):
"This class is not intended for subclassing. Instead, you use instances of it as-is in situations where you want your application’s user interface to reflect the hierarchical nature of your content." (UINavigationController Class Reference, Apple)
The question is: why can I use my custom subclass of UINavigationBar in a UINavigationController using IB and I can't do it programmatically? All that can be done in IB should not be able to do programmatically?
Thanks,
Duccio
> Luke
>
> On Dec 8, 2009, at 9:46 AM, Duccio wrote:
>
>> Hi.
>>
>> I created CustomNavBar subclassing UINavigationBar.
>>
>> In Interface Builder I drag a Navigation Controller (UINavigationController) from the library to the document. Under this object in document window I can see a Navigation Bar (UINavigationBar). Clicking it and using the Identity Inspector I can change the class from standard UINavigationBar to my CustomNavBar.
>>
>> How can I reproduce it programmatically?
>>
>> MyViewController *myViewController = [[MyViewController alloc] init];
>> UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:myViewController];
>> [myViewController release];
>>
>> UINavigationController navigationBar property is read only so I can't do:
>>
>> CustomNavBar *customNavBar = [[CustomNavBar alloc] init];
>> navController.navigationBar = customNavBar;
>> [customNavBar release];
>>
>> What should I do to customize the navigation bar programmatically? Is IB more "powerful" than "code"? I believed all that can be done in IB could be done also programmatically.
>>
>> 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