Ios 分段控制标题显示在模拟器上,但不显示在设备上
以下是我在模拟器上看到的:Ios 分段控制标题显示在模拟器上,但不显示在设备上,ios,Ios,以下是我在模拟器上看到的: 以下是我在设备上看到的内容: 代码如下: - (void)buildNavBarTitle { self.navigationItem.title = nil; UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, self.navigationController.navigationBar.frame.size.height)]; UISegmentedCo
以下是我在设备上看到的内容: 代码如下:
- (void)buildNavBarTitle
{
self.navigationItem.title = nil;
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, self.navigationController.navigationBar.frame.size.height)];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithFrame:CGRectMake(0, 0, 160, view.frame.size.height - 10)];
segmentedControl.tintColor = [UIColor blackColor];
[segmentedControl insertSegmentWithTitle:@"New" atIndex:0 animated:NO];
[segmentedControl insertSegmentWithTitle:@"Today" atIndex:1 animated:NO];
[view addSubview:segmentedControl];
self.navigationItem.titleView = view;
}
我有
- 已删除模拟器和设备上的应用程序
- 重新启动的xCode
- cmd+shift+k进行清洁
- cmd+shift+alt+k清除生成文件夹
NSArray *itemArray = [NSArray arrayWithObjects: @"New", @"Today", nil];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:itemArray]
segmentedControl.frame = CGRectMake(35, 200, 250, 50);
segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
segmentedControl.selectedSegmentIndex = 0;
[view addSubview:segmentedControl];
试试这个:
NSArray *itemArray = [NSArray arrayWithObjects: @"New", @"Today", nil];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:itemArray]
segmentedControl.frame = CGRectMake(35, 200, 250, 50);
segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
segmentedControl.selectedSegmentIndex = 0;
[view addSubview:segmentedControl];
当我使用UIAppearance设置所有该类型控件的样式时,我遇到了类似的问题。这与我试图从文本中移除阴影有关,它导致文本无法显示。在允许阴影后,您无法注意到它确实在那里,文本再次出现
我已经向苹果提交了一个与此相关的bug。当我使用UIAppearance设计所有此类控件的样式时,我遇到了类似的问题。这与我试图从文本中移除阴影有关,它导致文本无法显示。在允许阴影后,您无法注意到它确实在那里,文本再次出现
我已经向苹果提交了一个关于这个的bug。你的模拟器和设备都是完全相同的ios吗?它们都是6.1,但模拟器是“6.1(10B141)”而设备是“6.1.3(10B329)”使用UISegmentedControl initWithItems:initialiser有什么区别吗?不要忘了在初始化后设置帧。您的模拟器和设备都是完全相同的ios吗?它们都是6.1,但模拟器是“6.1(10B141)”,设备是“6.1.3(10B329)”。使用UISegmentedControl initWithItems:initialiser有什么区别吗?不要忘记在初始化后设置帧。