[MonoTouch] Change url of webreference

Robert Jordan robertj at gmx.net
Sun Oct 23 10:21:54 EDT 2011


On 23.10.2011 15:25, Andreas Ploetzeneder wrote:
> Thank you robert, for your Feedback
>
> Regarding coloring the Font Color of the navigationbar, i get "unrecognized
> selector sent to instance". Can the reason be, that it just works on ios5?

Oops, sorry. textAttributes/SetTextAttributes is only available
in iOS 5:

https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UINavigationBar_Class/Reference/UINavigationBar.html

But you can replace the title view of the bar with a label
that can be customized:

using (var label = new UILabel()) {
	label.Text = NavigationItem.Title;
	label.TextColor = UIColor.White;
	label.BackgroundColor = UIColor.Clear;
	// replace the title view of the current nav item:
	NavigationItem.TitleView = label;
	label.SizeToFit();
}

Robert

>
>
>
>
>>
>> public override void ViewDidLoad ()
>> {
>>         base.ViewDidLoad ();
>>
>>         // Hintergrundfarbe:
>>         NavigationController.**NavigationBar.TintColor = UIColor.Red;
>>
>>         // Texteigenschaften:
>>         var textAttr = new UITextAttributes();
>>         textAttr.TextColor = UIColor.White;
>>
>>         // Texteigenschaften des Titels setzen:
>>         NavigationController.**NavigationBar
>>                 .SetTitleTextAttributes(**textAttr);
>>
>> }
>>
>



More information about the MonoTouch mailing list