Customizeappearance compatibility on others iOS

大兔子大兔子 提交于 2020-01-03 05:06:12

问题


I did not see an answer to my question yet so I ask it : I am currently using (void)customizeappearance to customize the design of my tabbar and navbar. Will that function restrain the use of my app to iOS5-based iPhone only ? If not, will my bars be seen the same in all devices ?

Thanks in advance.

Here is the method I am using :

- (void)customizeAppearance
{
    UIImage *tabBackground = [[UIImage imageNamed:@"bg_tab"]     resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
    [[UITabBar appearance] setBackgroundImage:tabBackground];
    [[UITabBar appearance] setSelectionIndicatorImage:
    [UIImage imageNamed:@"bg_tab_selected"]];
    [[UITabBar appearance] setSelectedImageTintColor:[UIColor whiteColor]];
}

回答1:


customizeappearance isn't a standard method. What methods are you actually calling to do the customisation?

If you are using methods like setBackgroundImage: or setTintColor: there's a good chance that your app will only run on iOS5 and will crash on iOS4. Post the methods you are using and I'll show you how to do it safely for iOS4.

Here's another answer that explains how to safely call iSO5-only customisation methods so that they won't crash on iOS4: iOS change tabbar item color is safe?

Here's an example of how to customise in a way that works on iOS 4 & 5: tabbar item image and selectedImage



来源:https://stackoverflow.com/questions/9150956/customizeappearance-compatibility-on-others-ios

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!