Tag: uiappearance

UISwitch setThumbTintColor导致崩溃(仅iOS 6)?

更新:从苹果收到一封邮件说,该错误/问题已被修复,下一个SDK版本将不会有这个问题。 和平! 我在我的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]]; } 然后我调用- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 我也用ARC。 在iOS 6中,我的应用程序不断崩溃。 我启用NSZombie,它一直说: *** -[UIDeviceRGBColor release]: message sent to deallocated instance 0x9658eb0 现在我已经意识到上述的一个完美可重复的stream程。 当我在customAppearance中单独注释掉setThumbTintColor行时,一切正常。 当我使用setThumbTintColor行代替时,应用程序每次都以完全相同的方式崩溃。 这是UISwitch / setThumbTintColor / UIColor的任何人都知道的问题? […]

如何设置UITabBarItem的未选色调,***包括系统项目***(iOS7)

( 注:我看到有几个类似的问题,但他们都没有看到我想改变定制和系统UITabBarItems的未选定外观的具体问题。) 我正在iOS7中工作。 我有一个button的UITabBar。 其中一些是我的button,一些是系统button。 例: UITabBarItem *searchButton = [[UITabBarItem alloc] initWithTabBarSystemItem: UITabBarSystemItemSearch tag: navSearchItem]; UITabBarItem *bookMkButton = [[UITabBarItem alloc] initWithTabBarSystemItem: UITabBarSystemItemBookmarks tag: navBookmarksItem]; UITabBarItem *homeButton = [[UITabBarItem alloc] initWithTitle: @"Home" image: [self tabBarImageNamed: @"home-tab"] tag: navHomeItem]; UITabBarItem *setingButton = [[UITabBarItem alloc] initWithTitle: @"Settings" image: [self tabBarImageNamed: @"settings-tab"] tag: navSettingsItem]; navTabBar.items = @[ searchButton, homeButton, […]

自定义左右UISegmentedControlbutton

我试图自定义下面的分段控制,使用第一个button的左图像和第二个button的右图像。 我将如何使用UIAppearance来做到这一点? 我想改变下面的segmentedControl: 到类似如下的东西: 我想使用自定义图像的原因是我可以改变button的angular落。 如果你看看蓝色的分段控制,它更平方(我的图像有它自己的angular落)。 我正在想这样的事情,但没有用。 UIImage *leftImage = [[UIImage imageNamed:@"leftControl.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)]; UIImage *rightImage = [[UIImage imageNamed:@"rightControl.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 15, 0, 15)]; [[UISegmentedControl appearance] setBackgroundImage:leftImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault ]; [[UISegmentedControl appearance] setBackgroundImage:rightImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];

覆盖MFMailComposeViewController的UIAppearance属性

我正在使用UIAppearance协议来设置UINavigationBar对象的整个我的应用程序的背景图像。 [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"image-name"] forBarMetrics:UIBarMetricsDefault]; 我想重写这个MFMailComposeViewController的实例,以便显示默认样式导航栏。 我试图使用appearanceWhenContainedIn来设置这个,这适用于iOS 5,但不适用于iOS 6。 [[UINavigationBar appearanceWhenContainedIn:[MFMailComposeViewController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; 我是否犯了一个错误,还是有更好的方法来完成这个?

titleTextAttributes iOS 7中的UIAppearance字体

我正在使用UIAppearance将字体应用到UINavigationBar和UIBarButtonItem,我遇到了问题。 我跑这个代码: [[UIBarButtonItem appearanceWhenContainedIn:[UIToolbar class], nil] setTitleTextAttributes: @{NSFontAttributeName : [UIFont fontWithName:@"My_Font" size:17.0]} forState:UIControlStateNormal]; NSLog(@"%@", [[UIBarButtonItem appearanceWhenContainedIn: [UIToolbar class], nil] titleTextAttributesForState:UIControlStateNormal]); 并在iOS 7上的日志的结果是: (null) iOS 6的结果是: { NSFont = "<UICFFont: 0x1d897a80> font-family: \"My_Font\"; font-weight: normal; font-style: normal; font-size: 17px"; } 我无法find任何iOS 7文档,这将表明这不应该工作,有没有其他人有这个问题? 编辑1 我实际上已经得到这个与[UINavigationBar appearance]的问题是,我设置的大小为0,以便将字体设置为默认的navbar / barButtonItem大小,如NSString UIKit Additions Reference中所述,但这显然不再适用于iOS 7.相反,将点大小设置为0将返回系统字体。 我仍然无法设置titleTextAttributes [UIBarButtonItem appearanceWhenContaintedIn:[UIToolbar class], nil]]

MFMailComposeViewController由于iOS6上的全局外观属性而崩溃

当我介绍一个MFMailComposeViewController时,我得到以下崩溃: 2013-11-08 11:04:05.963 <redacted>[7108:1603] *** Assertion failure in NSDictionary *_UIRecordArgumentOfInvocationAtIndex(NSInvocation *, NSUInteger, BOOL)(), /SourceCache/UIKit/UIKit-2380.17/UIAppearance.m:1118 2013-11-08 11:04:06.032 <redacted>[7108:1603] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unknown key, "NSColor" in title text attributes dictionary' 我在AppDelegate的application:didFinishLaunchingWithOptions:追踪了下面的外观设置application:didFinishLaunchingWithOptions: method: [[UINavigationBar appearance] setTitleTextAttributes: @{NSForegroundColorAttributeName : [UIColor whiteColor]}]; 注释该行出了窍门,但遗失了应用程序的其余部分,所以我试着将titleTextAttributes设置为MFMailComposeViewController的空字典: 尝试#1 [[UINavigationBar appearanceWhenContainedIn: NSClassFromString(@"MFMailComposeViewController"), nil] setTitleTextAttributes:@{ }]; 这导致相同的崩溃。 和 [[UINavigationBar appearanceWhenContainedIn: […]

使用UIAppearance自定义iOS UIDatepicker

优衣库的新的闹钟应用程序有一个自定义的UIDatePicker : 我想创build我自己的自定义UIDatePicker 。 我试图改变DatePicker的外观,但在UIDatePicker查找UI_APPEARANCE_SELECTOR 什么都不返回。 意思是不可能改变任何值,按照文档: 为了支持外观定制,一个类必须符合UIAppearanceContainer协议,相关的访问器方法必须用UI_APPEARANCE_SELECTOR标记。 如何改变我的UIDatePicker的外观?

如何将UIAppearance Proxy属性应用于UILabel?

在尝试将UIAppearance代理样式应用于UILabel类代理时,我一直得到不可靠的结果。 例如,下面的工作,我期望: [[UILabel appearance] setFont:[UIFont fontWithName:SOME_FONT size:SOME_SIZE]]; [[UILabel appearance] setShadowColor:[UIColor blackColor]]; 设置textColor不起作用,但是,这: [[UILabel appearance] setColor:[UIColor greenColor]]; 确实有效 那种 。 这是有点不可靠的,并导致任何特定于实例的调用setTextColor:被忽略。 将UIA外观样式应用于UILabel的正确方法是什么?