【发布时间】:2014-11-19 03:10:04
【问题描述】:
我花了很多时间尝试为 iPhone6/6+ 优化我的应用程序,但还没有获得一些 UI 元素来优化。
- 具有自定义图像背景的 UINavigationBar 和 UISearchBar [已解决]:
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navBar"] forBarMetrics:UIBarMetricsDefault];
UISearchBar 的背景是在故事板中设置的。
UINavigationBar 和 UISearchBar 的 ImageSet 包含 1x、2x 和 3x png 文件。
- UITableViewCell:[已解决]
cellForRowAtIndexPath:
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)];
- UISearchDisplayController 位置(1 - 搜索已激活;2 - 搜索开始):
感谢任何帮助!
谢谢
【问题讨论】:
-
#2:您正在为
UISegmentedControl设置框架。适用于 iPhone 4S、5/5S、6 和 6+ 的自适应 UI 需要使用约束/自动布局。更好的方法是 Storyboard 单元格/xib 单元格(带有约束),而不是在代码中生成单元格,但如果您愿意,可以在代码中添加约束。 -
@RoboticCat:谢谢!我的注意力不集中-在另一堂课上我完全按照你写的那样做))你对#1和#3有什么解决方案吗?
-
绝对不知道#1 或#3。祝你好运。
标签: ios optimization iphone-6 iphone-6-plus