xcode:分段控件出现在sim卡上,而不是设备上

xcode:分段控件出现在sim卡上,而不是设备上,xcode,device,uisegmentedcontrol,Xcode,Device,Uisegmentedcontrol,我有一个iPad应用程序,有几个分段控件,包括一个视图和两个控件 从这个角度来看,sim卡上显示的一切,包括正常和视网膜。但是,在设备中,只有一个显示 以下是设备上未显示的代码。。我已经检查过,组成控件的所有图像都复制到捆绑资源中。我试过搬家、打扫等,没有乐趣。我一定错过了什么(希望很简单) 作为参考,此代码在同一视图中不起作用: -(void) buildColorBar { //NSLog(@"%s", __FUNCTION__); UISegmentedControl *colorCo

我有一个iPad应用程序,有几个分段控件,包括一个视图和两个控件

从这个角度来看,sim卡上显示的一切,包括正常和视网膜。但是,在设备中,只有一个显示

以下是设备上未显示的代码。。我已经检查过,组成控件的所有图像都复制到捆绑资源中。我试过搬家、打扫等,没有乐趣。我一定错过了什么(希望很简单)

作为参考,此代码在同一视图中不起作用:

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

 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]];

NSLog(@"Portrait");
CGRect frame = CGRectMake(35, 950, 700, 35);
colorControl.frame = frame;

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

     colorControl.segmentedControlStyle = UISegmentedControlStyleBar;

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

     // Add the control to the window
     [self.view addSubview:colorControl];


}
作为参考,此控制代码在以下情况下有效:

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

 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]];

NSLog(@"Portrait");
CGRect frame = CGRectMake(35, 950, 700, 35);
colorControl.frame = frame;

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

     colorControl.segmentedControlStyle = UISegmentedControlStyleBar;

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

     // Add the control to the window
     [self.view addSubview:colorControl];


}

是否有规则禁止在一个视图中使用两个分割控件?

我发现分割控件中的一个图像看起来像在捆绑包中,但实际上不是。皮塔,但至少,它是有效的。

明显的问题。。。您是否已输入NSLog并确保代码正在运行?制作一个带有随机背景颜色的UIView,看看是创建控件有问题,还是基本布局/添加子视图有问题?是的,代码已记录并正在运行。我可以看到这些按钮也可以(在sim卡上)工作。奇怪的