uiappearance

titleTextAttributes UIAppearance font in iOS 7

99封情书 提交于 2019-11-27 01:03:14
问题 I am using UIAppearance to apply fonts to UINavigationBar and UIBarButtonItem and I am having problems. I ran this code: [[UIBarButtonItem appearanceWhenContainedIn:[UIToolbar class], nil] setTitleTextAttributes: @{NSFontAttributeName : [UIFont fontWithName:@"My_Font" size:17.0]} forState:UIControlStateNormal]; NSLog(@"%@", [[UIBarButtonItem appearanceWhenContainedIn: [UIToolbar class], nil] titleTextAttributesForState:UIControlStateNormal]); and the result of that log on iOS 7 is: (null)

How to set font & color of the title in UINavigationBar using iOS5 appearance API?

只谈情不闲聊 提交于 2019-11-26 22:33:24
问题 I have a multiple View Controllers and I want to set the font color of all to red. [[UINavigationBar appearance] setFont:[UIFont boldSystemFontOfSize:12.0]]; is throwing an unrecognized selector error. How can I fix this? 回答1: From Ray Wenderlich: http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5 // Customize the title text for *all* UINavigationBars [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor colorWithRed

How do I apply UIAppearance Proxy properties to UILabel?

旧街凉风 提交于 2019-11-26 20:45:17
I have been getting unreliable results while trying to apply UIAppearance proxy styles to the UILabel class proxy. For example, the following works as I would expect: [[UILabel appearance] setFont:[UIFont fontWithName:SOME_FONT size:SOME_SIZE]]; [[UILabel appearance] setShadowColor:[UIColor blackColor]]; Setting the textColor doesn't work, however, this: [[UILabel appearance] setColor:[UIColor greenColor]]; does work. Kind of . It's somewhat unreliable and causes any instance-specific calls to setTextColor: to be ignored. What is the correct way to apply UIAppearance styles to a UILabel? OK,

appearanceWhenContainedIn in Swift

假装没事ソ 提交于 2019-11-26 12:49:21
I'm trying to convert my app to the Swift language. I have this line of code: [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:textDictionary forState:UIControlStateNormal]; How to convert it to Swift? In Apple's docs , there is no such method. Update for iOS 9: If you're targeting iOS 9+ (as of Xcode 7 b1), there is a new method in the UIAppearance protocol which does not use varargs: static func appearanceWhenContainedInInstancesOfClasses(containerTypes: [AnyObject.Type]) -> Self Which can be used like so: UITextField

How do I apply UIAppearance Proxy properties to UILabel?

[亡魂溺海] 提交于 2019-11-26 07:44:19
问题 I have been getting unreliable results while trying to apply UIAppearance proxy styles to the UILabel class proxy. For example, the following works as I would expect: [[UILabel appearance] setFont:[UIFont fontWithName:SOME_FONT size:SOME_SIZE]]; [[UILabel appearance] setShadowColor:[UIColor blackColor]]; Setting the textColor doesn\'t work, however, this: [[UILabel appearance] setColor:[UIColor greenColor]]; does work. Kind of . It\'s somewhat unreliable and causes any instance-specific calls