Ios iphone6/6+;优化问题
我花了很多时间尝试为iPhone6/6+优化我的应用程序,但有几个UI元素还没有得到优化Ios iphone6/6+;优化问题,ios,optimization,iphone-6,iphone-6-plus,Ios,Optimization,Iphone 6,Iphone 6 Plus,我花了很多时间尝试为iPhone6/6+优化我的应用程序,但有几个UI元素还没有得到优化 UINavigationBar&带有自定义图像背景的UISearchBar[已解决]: UISearchBar的背景设置在故事板中 UINavigationBar和UISearchBar有一个图像集,其中包含1x、2x和3x png文件 UITableViewCell:[已解决] cellForRowAtIndexPath: cell = [[UITableViewCell alloc] initWit
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
[cell setBackgroundColor:[UIColor clearColor]];
UISegmentedControl *mapTypeSelect = [[UISegmentedControl alloc]
initWithItems:
[NSArray arrayWithObjects:
NSLocalizedString(@"MAP_STANDART", nil),
NSLocalizedString(@"MAP_HYBRID", nil),
NSLocalizedString(@"MAP_SATELLITE", nil),
nil]];
CGSize cF = cell.frame.size;
[mapTypeSelect setFrame:CGRectMake(10, 5, cF.width-20, cF.height-10)];
谢谢我已经从中找到了问题1的解决方案 在@cat answer之后编辑
UIEdgeInsets stretchablePart = { .left = 0, .right = 50, .top = 0, .bottom = 0 };
[[UINavigationBar appearance] setBackgroundImage:[[UIImage imageNamed:@"navBar"] resizableImageWithCapInsets:stretchablePart resizingMode:UIImageResizingModeStretch] forBarMetrics:UIBarMetricsDefault];
其中,navBar是由1x、2x和3x图像组成的图像集#2:您正在为
UISegmentedControl设置帧。适用于iPhone 4S、5/5S、6和6+的自适应UI需要使用约束/自动布局。更好的方法是使用故事板单元/xib单元(带有约束),而不是在代码中生成单元,但是如果愿意,可以在代码中添加约束。@ROBOCTCAT:谢谢!我的注意力不集中——在另一节课上,我完全按照你写的那样做了。)你对#1和#3有什么解决办法吗?绝对不知道#1或#3。祝你好运。难道你不想让瓶盖镶嵌物盖住泡泡,这样只有中间部分被拉伸了吗?
UIEdgeInsets stretchablePart = { .left = 0, .right = 50, .top = 0, .bottom = 0 };
[[UINavigationBar appearance] setBackgroundImage:[[UIImage imageNamed:@"navBar"] resizableImageWithCapInsets:stretchablePart resizingMode:UIImageResizingModeStretch] forBarMetrics:UIBarMetricsDefault];