uiappearance

Custom Container Controller: transitionFromViewController: View not properly layed-out before animation

試著忘記壹切 提交于 2019-12-20 08:36:59
问题 This is both a question and a partial solution. *Sample project here: https://github.com/JosephLin/TransitionTest Problem 1: When using transitionFromViewController:... , layouts done by the toViewController 's viewWillAppear: doesn't show up when the transition animation begins. In other words, the pre-layout view shows during the animation, and it's contents snap to the post-layout positions after the animation. Problem 2: If I customize the background of my navbar's UIBarButtonItem , the

Custom UINavigationBar background image appears darker than the original image

左心房为你撑大大i 提交于 2019-12-20 06:26:48
问题 I am customizing a UINavigationBar like so: UIImage * img = [UIImage imageNamed:@"background.png"]; [[UINavigationBar appearance] setBackgroundImage:img forBarMetrics:UIBarMetricsDefault]; My original image background.png looks like this: It has a flat color #4b0367 The resulting NavigationBar looks like this: It has the color #311253 which is different from the original! Apparently UIKit changes the color. Note: Setting tintColor had no effect. Setting a transparent background image + a

UIAppearance Remove Custom NavBar Background for UIPopoverController

北战南征 提交于 2019-12-19 02:52:16
问题 I'm in the process of incorporating iOS 5's UIAppearance feature to give my universal app a unique theme. Currently, I have implemented some code in my App Delegate to give the app custom navigation bars: UIImage *navBarImage = [[UIImage imageNamed:@"navigationBar.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(7, 7, 7, 7)]; [[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault]; This works well and changes all the navigation bars from Apple's plain

UIAppearance setTranslucent error: Illegal property type, c for appearance setter, _installAppearanceSwizzleForSetter

大兔子大兔子 提交于 2019-12-18 18:54:13
问题 Trying out iOS 7 did: [[UINavigationBar appearance] setTranslucent:NO]; Got crash and error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** Illegal property type, c for appearance setter, _installAppearanceSwizzleForSetter:' *** First throw call stack: (0x16ad9b8 0x142e8b6 0x16ad7ab 0x72163d 0x724c34 0x169daca 0x169d8de 0x6c09 0x228ea9 0x2296e9 0x22ab5e 0x240a6c 0x240fd9 0x22c7d5 0x35a4906 0x35a4411 0x16293e5 0x162911b 0x1653b30 0x165310d 0x1652f3b

UIAppearance proxy for custom objects

浪子不回头ぞ 提交于 2019-12-18 10:59:19
问题 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

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

≡放荡痞女 提交于 2019-12-18 07:17:33
问题 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." 回答1: Had the

Change the selected cell background colour using UIAppearance

余生颓废 提交于 2019-12-18 07:14:23
问题 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 ? 回答1: 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

Override UIAppearance property for MFMailComposeViewController

混江龙づ霸主 提交于 2019-12-17 18:33:24
问题 I am using the UIAppearance protocol to set the background image of UINavigationBar objects throughout my app. [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"image-name"] forBarMetrics:UIBarMetricsDefault]; I would like to override this for instances of MFMailComposeViewController so that the default style navigation bar is displayed. I attempted to use appearanceWhenContainedIn to set this and this works on iOS 5 but not on iOS 6. [[UINavigationBar

appearanceWhenContainedIn in Swift

帅比萌擦擦* 提交于 2019-12-17 02:33:38
问题 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. 回答1: 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

Appearance proxies / UI_APPEARANCE_SELECTOR in Swift?

不羁的心 提交于 2019-12-13 11:34:33
问题 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? 回答1: Mark your custom view property as dynamic . For example: class YourCustomView: UIView { @objc dynamic var subviewColor: UIColor? { get {