landscapeImagePhone的正确尺寸?

时间:2012-06-12 19:12:14

标签: iphone ios5 uikit uibarbuttonitem

UIBarButtonItem landscapeImagePhone图片的正确尺寸是什么?

1 个答案:

答案 0 :(得分:4)

“iOS人机界面指南”中没有记录这一点:

http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html

这是我的选择:将正常的肖像图像调整为(17,17),并将其用作landscapeImagePhone图像。您可以将(17,17)尺寸调整为您想要的尺寸,直到看起来不错,但它不应大于标准肖像barButton图像尺寸(20,20)。

// resize the image for landscape
UIImage *settingsImage = [UIImage imageNamed:@"settings"];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:settingsImage
                                                           landscapeImagePhone:[settingsImage resizedImage:CGSizeMake(17.f, 17.f) interpolationQuality:kCGInterpolationHigh]
                                                                         style:UIBarButtonItemStyleBordered target:self action:@selector(settingsButtonClicked:)];

注意:对于UIImage的resizedImage方法,你可以在GitHub上找到很多UIImage目录,我使用这个git:https://github.com/mbcharbonneau/UIImage-Categories 你可以删除UIImage + Alpha和UIImage + Resize,因为我们不需要它们