2012-05-02 47 views
3

我注意到,在我的一個分段控件中,很難看到選中哪個段。我在想我可以加粗字體,或者稍微增加字體大小。我試着這樣做,但它不起作用:在uisegmentedcontrol中更改所選段的字體

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

我的文本在段控件的兩個段中看起來都是一樣的。我需要做這樣的事情嗎? Change textColor in UISegmentedcontrol

我希望在iOS 5中更簡單的方法,如果可能的話,增加外觀。謝謝。

+0

可能在這裏回答:http://stackoverflow.com/questions/2280391/change-font-size-of-uisegmentedcontrol – danh

回答

2

我不確定,但我認爲[UIFont boldSystemFontOfSize:16.0f]; f失蹤。試試這個,告訴我

也NSLog的字典的值來檢查值是否設置屬性格式或不

使用別的

的NSDictionary *屬性= [NSDictionary的dictionaryWithObject:字體 forKey:UITextAttributeFont]。 這個我看到有些時候prblems是由於這個。我不知道這是爲什麼。

相關問題