首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >iPhone 6/6+优化问题

iPhone 6/6+优化问题
EN

Stack Overflow用户
提问于 2014-11-19 03:10:04
回答 1查看 319关注 0票数 2

我花了很多时间来优化iPhone6 6/6+的应用程序,但是还没有获得一些UI元素来进行优化。

  1. 自定义图像背景的UINavigationBar & UISearchBar 解决了

代码语言:javascript
运行
复制
    [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navBar"]       forBarMetrics:UIBarMetricsDefault];

UISearchBar的背景设置在故事板中。

ImageSet用于UINavigationBar和UISearchBar,其中包含1x、2x和3xPNG文件。

  1. UITableViewCell:解决了

cellForRowAtIndexPath:

代码语言:javascript
运行
复制
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. UISearchDisplayController位置(1 -搜索启动;2-搜索开始):

任何帮助都是非常感谢的!

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-19 08:20:08

我已经从iOS 8 NavigationBar BackgroundImage找到了问题#1的解决方案

在@RoboticCat应答之后编辑

代码语言:javascript
运行
复制
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图像的图像集。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27008283

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档