Ios7 iOS 7中的UISegmentedControl

Ios7 iOS 7中的UISegmentedControl,ios7,uisegmentedcontrol,Ios7,Uisegmentedcontrol,我有一个有两个分段控件的项目。他们都达到了7.0。现在一个人没有了。我读过关于色彩的问题,但我认为这是不同的 两个控件都将UIImage用作段。一方面,所有图像都显示正确。另一方面,我得到了所有的蓝色图像 我是做错了什么还是这是一个错误 以下是故障段的代码: UISegmentedControl *colorControl = [[UISegmentedControl alloc] initWithItems: [NSArray arrayWithObjects: [UIImag

我有一个有两个分段控件的项目。他们都达到了7.0。现在一个人没有了。我读过关于色彩的问题,但我认为这是不同的

两个控件都将UIImage用作段。一方面,所有图像都显示正确。另一方面,我得到了所有的蓝色图像

我是做错了什么还是这是一个错误

以下是故障段的代码:

UISegmentedControl *colorControl = [[UISegmentedControl alloc] initWithItems:
    [NSArray arrayWithObjects:
    [UIImage imageNamed:@"White.png"],
    [UIImage imageNamed:@"Red.png"],
    [UIImage imageNamed:@"Yellow.png"],
    [UIImage imageNamed:@"Green.png"],
    [UIImage imageNamed:@"Blue.png"],
    [UIImage imageNamed:@"Purple.png"],
     [UIImage imageNamed:@"Black.png"], nil]];



    CGRect frame = CGRectMake(rect.origin.x + kLeftMargin, rect.size.height - kPaletteHeight - kTopMargin, rect.size.width - (kLeftMargin + kRightMargin), kPaletteHeight );
    colorControl.frame = frame;

    // Add DoubleTap Color capability

    gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showMoreColors:)];
    [gesture setNumberOfTapsRequired:2];

    [colorControl addGestureRecognizer:gesture];

    // When the user chooses a color, the method changeColor: is called.
    [colorControl addTarget:self action:@selector(changeColor:) forControlEvents:UIControlEventValueChanged];

    // Make sure the color of the color complements the black background
    //colorControl.tintColor = [UIColor clearColor];

    // Add the control to the window
    [self.view addSubview:colorControl];
虽然图像都是蓝色的,但片段工作正常。

多亏了,我制定了以下修复方案:

-(void) buildColorBar {
    //NSLog(@"%s", __FUNCTION__);

    UIImage *whiteImage = [UIImage imageNamed:@"White.png"];
    UIImage *blackImage = [UIImage imageNamed:@"Black.png"];
    UIImage *purpleImage = [UIImage imageNamed:@"Purple.png"];
    UIImage *redImage = [UIImage imageNamed:@"Red.png"];
    UIImage *blueImage = [UIImage imageNamed:@"Blue.png"];
    UIImage *greenImage = [UIImage imageNamed:@"Green.png"];
    UIImage *yellowImage = [UIImage imageNamed:@"Yellow.png"];

    NSArray *colorArray = [[NSArray alloc] initWithObjects:
                    [whiteImage imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal],
                    [redImage imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal ],
                    [yellowImage imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal ],
                    [greenImage imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal ],
                    [blueImage imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal ],
                    [purpleImage imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal ],
                    [blackImage imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal ], nil ];


    UISegmentedControl *colorControl = [[UISegmentedControl alloc] initWithItems:colorArray];

    CGRect frame = CGRectMake(rect.origin.x + kLeftMargin, rect.size.height - kPaletteHeight - kTopMargin, rect.size.width - (kLeftMargin + kRightMargin), kPaletteHeight );
    colorControl.frame = frame;
我希望它能帮助别人