How can I get the iOS 7 default blue color programmatically?

后端 未结 15 1241
一整个雨季
一整个雨季 2020-12-22 16:04

I\'m creating custom elements in my app and want to match the look and feel of the new iOS. iOS 7 introduced to us a very common lighter blue color, the default color or tin

15条回答
  •  一生所求
    2020-12-22 16:57

    Adding a category to UIColor the following way will make it available to you anytime you need it or even change its definition accross your code:

    @interface UIColor (iOS7Colors)
    
    + (instancetype)iOS7blueColor;
    
    @end
    
    @implementation UIColor (SpecialColors)
    
    + (instancetype)iOS7blueColor;
    {
        return [UIColor colorWithRed:0.0f green:0.22f blue:122.0/255.0 alpha:1.0f];
    }
    

    Once you import the Category in your code you can call the color by using:

    UIColor *myBlueColor = [UIColor iOSblueColor];
    

提交回复
热议问题