出于某种原因,我搜索了高和低,无法找到我需要为Watchkit
中的38mm
和42mm
尺寸提供背景图像的确切图像尺寸。目前,我正在使用“缩放填充”扩展较小的图像。Watchkit界面控制器38mm和42mm背景图像尺寸
我不希望它拉长,所以我要寻找真正的像素尺寸。
出于某种原因,我搜索了高和低,无法找到我需要为Watchkit
中的38mm
和42mm
尺寸提供背景图像的确切图像尺寸。目前,我正在使用“缩放填充”扩展较小的图像。Watchkit界面控制器38mm和42mm背景图像尺寸
我不希望它拉长,所以我要寻找真正的像素尺寸。
下面是我用于在我的WKInterfaceController
中获取背景图像大小的代码。我的应用程序有一个页面控件,你可能不需要额外的-14。
-(CGSize)backgroundSize
{
CGRect contentFrame = self.contentFrame;
CGSize size = contentFrame.size;
CGFloat contentScale = 2.0;
size.width *= contentScale;
size.height *= contentScale;
//I lined up the generated image with one in the simulator until
//they perfectly matched. I did this on both 38 and 42 mm.
//I am not sure why they all came out to be off 4.
//There is an offset of 10 in IB and I am not sure I need this
//to be 4 to match perfect.
size.height -= 4;
//it looks like there is 2 pixels around the edge
size.width -= 4;
//Using page mode we need to take off an additional 14 pixels for the page dots at the bottom
size.height -= 14;
return size;
}
或者更好的是,Watchkit是否允许我使用'CAGradientLayer'绘制本地渐变? – 2015-03-31 18:22:17
工作。谢谢! – 2015-03-31 19:11:57
要绘制渐变,您需要将其绘制到图像上,然后将其设置为组中的背景图像。您只能访问有限的界面元素,如https://developer.apple.com/library/ios/documentation/WatchKit/Reference/WatchKit_framework/index.html所述。您可以将CGGradient绘制到位图上下文中。 – 2015-03-31 20:01:11
你在寻找像素大小吗?这不是吗? http://www.macrumors.com/2014/11/18/apple-watch-resolutions/ – 2015-03-31 18:54:22
@Nic Hubbard Watch应用程序中的本地通知如何显示?是否与远程通知相同?通知控制器界面用于通过手表应用程序进行本地通知? – iOSdev 2015-04-28 07:29:45