【发布时间】:2013-10-01 17:20:49
【问题描述】:
我正在开发一个应用程序并应用全局格式,为此我在我的 appDelegate.m 文件中添加了以下几行
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
[self customizeAppearance];
return YES;
}
-(void)customizeAppearance{
int iOSVersion = [[[UIDevice currentDevice]systemVersion] intValue];
if (iOSVersion >= 7) {
//Customizing UIButton
[[UIButton appearance]setBackgroundColor:(UIColorFromRGB(toolbarTintColor))];
[[UIButton appearance]setTitleColor:(UIColorFromRGB(toolbarTextColor)) forState:UIControlStateNormal];
}
if (iOSVersion < 7) {
//Customizing UIButton
[[UIButton appearance]setBackgroundImage:[UIImage imageNamed:@"Button.png"] forState:UIControlStateNormal];
}
}
我根据 iOS 版本做了这两种样式,这会改变 UIbutton 样式,但我希望它只应用于 UIButtons,而不是 UIBarButtonItems 这可能吗??
更进一步,我想将此格式全局应用于 UIView 元素内的 UIButtons(不在 UITableViewCells 左右)可以这样做吗???
提前感谢您的支持
【问题讨论】:
标签: ios objective-c uibutton styles