2013-01-06 40 views

回答

0

,您應該使用UISegmentedControl的– setTitle:forSegmentAtIndex:,並通過他的NSString的自定義繪製使用的NSString UIKit的添置之一。

這個鏈接看看:http://developer.apple.com/library/ios/#documentation/uikit/reference/NSString_UIKit_Additions/Reference/Reference.html

+2

'的setTitle:forSegmentAtIndex:'需要一個'NSString'。這如何支持每個字符串使用不同的字體?也許你的意思是在用所需字體繪製的字符串中創建圖像後使用'setImage:forSegmentAtIndex:'。 – rmaddy

+0

您必須使用NSString UIKit添加方法(如' - drawInRect:withFont:')(請查看鏈接以獲取更多信息)手動繪製每個字符串。但是,這是一個棘手的方法,如果你可以使用'setImage:forSegmentAtIndex:' – Yaman

+0

,你會發現使用'setTitle:forSegmentAtIndex:'不可能實現。使用'setImage:forSegmentAtIndex:'不僅更容易,它是唯一的解決方案。 – rmaddy

相關問題