我花了很多时间来优化iPhone6 6/6+的应用程序,但是还没有获得一些UI元素来进行优化。
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navBar"] forBarMetrics:UIBarMetricsDefault];
UISearchBar的背景设置在故事板中。
ImageSet用于UINavigationBar和UISearchBar,其中包含1x、2x和3xPNG文件。
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)];
任何帮助都是非常感谢的!
谢谢
发布于 2014-11-19 08:20:08
我已经从iOS 8 NavigationBar BackgroundImage找到了问题#1的解决方案
在@RoboticCat应答之后编辑
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图像的图像集。
https://stackoverflow.com/questions/27008283
复制相似问题