English 中文(简体)
标准是什么 Apple果蓝色
原标题:What is the standard Apple blue colour?

1. 历史问题。

资料可在家庭调查中查阅:

UIColor.systemBlue


摘自......

//
//  UIColor.h
//  UIKit
//
//  Copyright (c) 2005-2013, Apple Inc. All rights reserved.
//

 ........ 

// Some convenience methods to create colours.
// These colors will be as calibrated as possible.
// These colors are cached.
+ (UIColor *)blackColor;      // 0.0 white 
+ (UIColor *)darkGrayColor;   // 0.333 white 
+ (UIColor *)lightGrayColor;  // 0.667 white 
+ (UIColor *)whiteColor;      // 1.0 white 
+ (UIColor *)grayColor;       // 0.5 white 
+ (UIColor *)redColor;        // 1.0, 0.0, 0.0 RGB 
+ (UIColor *)greenColor;      // 0.0, 1.0, 0.0 RGB 
+ (UIColor *)blueColor;       // 0.0, 0.0, 1.0 RGB 
+ (UIColor *)cyanColor;       // 0.0, 1.0, 1.0 RGB 
+ (UIColor *)yellowColor;     // 1.0, 1.0, 0.0 RGB 
+ (UIColor *)magentaColor;    // 1.0, 0.0, 1.0 RGB 
+ (UIColor *)orangeColor;     // 1.0, 0.5, 0.0 RGB 
+ (UIColor *)purpleColor;     // 0.5, 0.0, 0.5 RGB 
+ (UIColor *)brownColor;      // 0.6, 0.4, 0.2 RGB 
+ (UIColor *)clearColor;      // 0.0 white, 0.0 alpha 

Incredibly, they do not include "standard Apple button blue " ........

“entergraph

在项目中,我们总是有这样的情况:但是它只是一个野心。

#define APPLEBLUE [UIColor 
  colorWithRed:0/255.0 green:122/255.0 blue:255/255.0 alpha:1.0]

或者,你可以做这样的事情。

@implementation SomeButtons
{
UIColor *defaultColor;
}

-(id)initWithFrame:(CGRect)frame
    {
    defaultColor = [UIColor redColor];
    if(self = [super initWithFrame:frame])
        {
        for (UIView *v in self.subviews)
          if ([v isKindOfClass:[UIButton class]])
            defaultColor = [(UIButton *)v titleColorForState:UIControlStateNormal];
        }
    return self;
    }

-(id)initWithCoder:(NSCoder *)aCoder
    {
    if(self = [super initWithCoder:aCoder])
        {
        for (UIView *v in self.subviews)
          if ([v isKindOfClass:[UIButton class]])
            defaultColor = [(UIButton *)v titleColorForState:UIControlStateNormal];
        }
    return self;
    }

似乎几乎无法令人信服的是,返回纽顿和文字颜色的“标准 Apple果控制蓝色”并非易事。

这正是我们面临的 Android: 是否有任何人知道比较容易的方式? 我确实希望我没有明显的东西。 卡车

最佳回答

Since iOS 7 you can simply use this:

UIColor.systemBlue
问题回答

A bit late, but you can find the colour values in Apple s Human interface guidelines.

蓝色为(R, G, B) = (0, 122, 255) = #007AFF

Apple colours

我创建了一个GIST,为方便起见,由Unicoor推广。

计算数字彩色参数? 看来(14、122、254)。

“entergraph

然后增加一个类别:

@implementation UIColor (MyColors)

+ (UIColor*)appleBlue {
    return [UIColor colorWithRed:14.0/255 green:122.0/255 blue:254.0/255 alpha:1.0];
}

@end

如果你只考虑《欧洲刑法》的编码,那么:

#0E7AFE

迅速使用:

extension UIColor {
    static func appleBlue() -> UIColor {
        return UIColor.init(colorLiteralRed: 14.0/255, green: 122.0/255, blue: 254.0/255, alpha: 1.0)
    }
}

Updated Apple human interface link from the top comment





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...