0
我在全局设置所有UISegmentedControl的外观。但是我注意到,当我这样做时,它打破了禁用状态。UISegmentedControl的设置外观中断禁用状态
下面是代码,我必须改变titleTextAttributes
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont boldSystemFontOfSize:12], UITextAttributeFont,
[UIColor whiteColor], UITextAttributeTextColor,
[UIColor colorWithRed:0x49/255.0 green:0x49/255.0 blue:0x49/255.0 alpha:1], UITextAttributeTextShadowColor,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset,
nil];
[[UISegmentedControl appearance] setTitleTextAttributes:attributes forState:UIControlStateNormal];
现在这个伟大工程,所有分段控制器更新。
但我用setEnabled:forSegmentAtIndex禁用的项目不再被禁用,并且可点击。为什么会发生?我如何让他们再次被禁用。我试图将它应用到残疾人状态,但它不起作用。
[[UISegmentedControl appearance] setTitleTextAttributes:attributes forState:UIControlStateDisabled];
我有这个确切的问题。你能否更详细地解释你做了什么?谢谢。 – pizzafilms