Changing the font for selected segment in uisegmentedcontrol

I'm noticing that on one of my segmentedcontrols, it is hard to see which segment is selected. I was thinking I could bold the font, or increase the font size just slightly. I'm trying this, but it's not working:

UIFont *boldFont = [UIFont boldSystemFontOfSize:16.0];
    NSDictionary *fontDict = [[NSDictionary alloc] initWithObjectsAndKeys:boldFont, UITextAttributeFont, nil];
    [_tableSegmentedControl setTitleTextAttributes:fontDict forState:UIControlStateSelected];

My text looks the same in both segments of the segment control. Do I need to do something like this instead? Change textColor in UISegmentedcontrol

I was hoping for the easier approach in iOS 5 with the appearance additions if possible. Thanks.

Answers


i'm not sure but i think [UIFont boldSystemFontOfSize:16.0f]; f was missing. try this and tell me

also NSlog the value of dictionary to check whether the value is set propery or not

else use

NSDictionary *attributes = [NSDictionary dictionaryWithObject:font forKey:UITextAttributeFont]; this i have seen some times prblems are due to this. i dont know why this is.


Need Your Help

iOS: disable bounce scroll but allow normal scrolling

javascript ios iphone css mobile-safari

I don't want the content of my site sloshing around when the user hits the edge of a page. I just want it to stop.

How to assign a string value in Objective C using ARC?

objective-c automatic-ref-counting

Using ARC, is it now OK to assign a string value like this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.