uiappearance

Change navigation button color in MFMailComposerViewController on iOS 7

陌路散爱 提交于 2019-11-30 14:43:00
问题 I'm trying to change the text color for navigation buttons in a MFMailComposerViewController but it doesn't work like on iOS 6. In iOS 6 it worked with UIAppearance like this: // Navigation button UIBarButtonItem *barButton = [UIBarButtonItem appearance]; NSDictionary *barButtonTitleTextAttributes = @{UITextAttributeTextColor: [UIColor redColor]}; NSDictionary *disabledBarButtonTitleTextAttributes = @{UITextAttributeTextColor: [UIColor grayColor]}; [barButton setTitleTextAttributes

Change navigation button color in MFMailComposerViewController on iOS 7

浪子不回头ぞ 提交于 2019-11-30 11:06:31
I'm trying to change the text color for navigation buttons in a MFMailComposerViewController but it doesn't work like on iOS 6. In iOS 6 it worked with UIAppearance like this: // Navigation button UIBarButtonItem *barButton = [UIBarButtonItem appearance]; NSDictionary *barButtonTitleTextAttributes = @{UITextAttributeTextColor: [UIColor redColor]}; NSDictionary *disabledBarButtonTitleTextAttributes = @{UITextAttributeTextColor: [UIColor grayColor]}; [barButton setTitleTextAttributes:barButtonTitleTextAttributes forState:UIControlStateNormal]; [barButton setTitleTextAttributes

Customizing UIBarButtonItem “Done” style and “Plain” style separately using UIAppearance

浪子不回头ぞ 提交于 2019-11-30 06:54:21
I know how to customize UIBarButtonItem using -setBackgroundImage: forState: barMetrics: , but I would like to use different images for UIBarButtonItemStyleDone and UIBarButtonItemStylePlain . Is there a way to accomplish this using the UIAppearance protocol? Or do I have to set the image each time I want a "Done" style button? (I tried messing around with code like the following: [[UIBarButtonItem appearance] setBackgroundImage:image forState:UIControlStateNormal barMetrics:UIBarButtonItemStyleDone]; But that just sets every bar button with the "Done" image.) Thanks! Sergiy Salyuk In iOS 6

UISwitch setThumbTintColor causing crash (iOS 6 only)?

巧了我就是萌 提交于 2019-11-30 06:45:46
问题 UPDATE: Got a mail from Apple saying that the bug/issue has been fixed now and the next SDK release won't have this issue. Peace! I have this in the code for my AppDelegate: - (void) customizeAppearance { [[UISwitch appearance] setOnTintColor:[UIColor colorWithRed:0 green:175.0/255.0 blue:176.0/255.0 alpha:1.0]]; [[UISwitch appearance] setTintColor:[UIColor colorWithRed:255.0f/255.0f green:255.0f/255.0f blue:255.0f/255.0f alpha:1.000f]]; [[UISwitch appearance] setThumbTintColor:[UIColor

Appearance proxies / UI_APPEARANCE_SELECTOR in Swift?

ε祈祈猫儿з 提交于 2019-11-30 02:40:14
The Apple documentation states: To participate in the appearance proxy API, tag your appearance property selectors in your header with UI_APPEARANCE_SELECTOR. In Objective-C one can annotate properties with UI_APPEARANCE_SELECTOR like this: @property (nonatomic, strong) UIColor *foregroundColor UI_APPEARANCE_SELECTOR; How can I do the same 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:

respondsToSelector fails for appearance proxy

孤街醉人 提交于 2019-11-30 00:36:27
问题 I’m trying to detect an iOS 6-specific appearance method, by running respondsToSelector on the [UIBarButtonItem appearance] . However, it always returns NO for me, whatever selector I specify: // Should show NOPE in iOS 5, YEP in iOS 6. Shows NOPE always NSLog(@"%@", [[UIBarButtonItem appearance] respondsToSelector:@selector(setBackgroundImage:forState:style:barMetrics:)] ? @"YEP" : @"NOPE"); // Should show YEP in both iOS 5 and iOS 6. Shows NOPE always NSLog(@"%@", [[UIBarButtonItem

UIAppearance proxy for custom objects

拟墨画扇 提交于 2019-11-30 00:22:42
I have a custom object, it inherits from NSObject. This object does "some things", one of it is creating an UIView with some UIKit objects (UILabel, UIButtons ecc ecc...). This object has some properties like: textColor, font, backgroundColor... that are used to customize the appearance of the contained UIKit objects. I would like to customize this properties "one shot" for all created instances of this object, and I've looked at the UIAppearance protocol. Standard UIKit objects already conforms to UIAppearance protocol, but I don't want to apply the style on ALL UILabels or UIButtons. I want

Change the selected cell background colour using UIAppearance

瘦欲@ 提交于 2019-11-29 13:09:12
I need to change the selected cell background colour for all the cells in my app. As I know there is a way to use UIAppearance protocol for this purposes. Is it possible to realize this by the category for UITableViewCell ? null You can't do this direct to UITableViewCell, but you can do it for its contentView : [[UIView appearanceWhenContainedIn:[UITableViewCell class], nil] setBackgroundColor:[UIColor redColor]]; Note that it will change all the subViews bg color. Another option is writing a category or subclass the UITableViewCell with UI_APPEARANCE_SELECTOR mark, check this question: iOS:

How to set UIButton font via appearance proxy in iOS 8?

孤街浪徒 提交于 2019-11-29 12:27:59
I tried to set the font of UIButton via appearance proxy. But it doesn't seem to work. This is what I tried. UIButton.appearance().titleFont = UIFont(name: FONT_NAME_DEFAULT, size:20.0) UIButton.appearance().titleLabel?.font = UIFont(name: FONT_NAME_DEFAULT, size:20.0) How to set UIButton font via appearance proxy in iOS 8 ? EDIT : Found in vaberer's link : "I'm surprised that UIButton doesn't have any UI_APPEARANCE_SELECTOR properties, yet conforms to the UIAppearance protocol." Had the same problem with a theme-able app. 1. Add this extension // UIButton+TitleLabelFont.swift import UIKit

UISwitch setThumbTintColor causing crash (iOS 6 only)?

喜夏-厌秋 提交于 2019-11-28 21:21:09
UPDATE: Got a mail from Apple saying that the bug/issue has been fixed now and the next SDK release won't have this issue. Peace! I have this in the code for my AppDelegate: - (void) customizeAppearance { [[UISwitch appearance] setOnTintColor:[UIColor colorWithRed:0 green:175.0/255.0 blue:176.0/255.0 alpha:1.0]]; [[UISwitch appearance] setTintColor:[UIColor colorWithRed:255.0f/255.0f green:255.0f/255.0f blue:255.0f/255.0f alpha:1.000f]]; [[UISwitch appearance] setThumbTintColor:[UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1.0]]; } Which I then call from - (BOOL)application:(UIApplication