uiappearance
Customize text color of UIDatePicker for iOS7 (just like Mailbox does)
I need similar for my app and have ended up going the long way round. It’s a real shame there isn’t an easier way to simply switch to a white text version of UIDatePicker. The code below uses a category on UILabel to force the label’s text colour to be white when the setTextColor: message … Read more
Appearance proxies / UI_APPEARANCE_SELECTOR in Swift?
Mark your custom view property as dynamic. For example: class YourCustomView: UIView { @objc dynamic var subviewColor: UIColor? { get { return self.yourSubview.backgroundColor } set { self.yourSubview.backgroundColor = newValue } } … } Then: YourCustomView.appearance().subviewColor = UIColor.greenColor()
How to set font & color of the title in UINavigationBar using iOS5 appearance API?
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:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0], UITextAttributeTextColor, [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8], UITextAttributeTextShadowColor, [NSValue valueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset, [UIFont fontWithName:@”Arial-Bold” size:0.0], UITextAttributeFont, nil]]; Or if you prefer with the object literal style: [[UINavigationBar appearance] setTitleTextAttributes:@{ UITextAttributeTextColor: [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 … Read more
appearanceWhenContainedIn in Swift
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.appearanceWhenContainedInInstancesOfClasses([MyViewController.self]).keyboardAppearance = .Light If you still need to support iOS 8 or earlier, use the … Read more