iOS 应用中生成的图像看起来与原始矢量图像不同
Generated image in iOS app looks different from original vector image
我在 xcode 图像资源中添加了一个 PDF 矢量文件。矢量文件具有颜色和设计。但是在模拟器上生成的时候,形状还在,但是颜色和设计都没有了,取而代之的是一个扁平的颜色。
// code to add the button
- (void) addReplyButton:(STRContent *)content {
UIButton *replyBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
replyBtn.frame = CGRectMake(0, 0, 0, 0);
[[replyBtn imageView] setContentMode: UIViewContentModeScaleAspectFit];
[replyBtn setImage:[UIImage imageNamed:@"reply_button"] forState:UIControlStateNormal];
[self.photoView addSubview:replyBtn];
}
原图
输出
我之前遇到过类似的问题,就我而言,有两个文件具有相同的文件名。
在本例中,显示的是在同名中随机选择的图片
我发现了问题 - 我正在执行 UIButtonTypeRoundedRect,其中 UIBottomtypeCustom 起作用。
UIButton *replyBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
我在 xcode 图像资源中添加了一个 PDF 矢量文件。矢量文件具有颜色和设计。但是在模拟器上生成的时候,形状还在,但是颜色和设计都没有了,取而代之的是一个扁平的颜色。
// code to add the button
- (void) addReplyButton:(STRContent *)content {
UIButton *replyBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
replyBtn.frame = CGRectMake(0, 0, 0, 0);
[[replyBtn imageView] setContentMode: UIViewContentModeScaleAspectFit];
[replyBtn setImage:[UIImage imageNamed:@"reply_button"] forState:UIControlStateNormal];
[self.photoView addSubview:replyBtn];
}
原图
输出
我之前遇到过类似的问题,就我而言,有两个文件具有相同的文件名。
在本例中,显示的是在同名中随机选择的图片
我发现了问题 - 我正在执行 UIButtonTypeRoundedRect,其中 UIBottomtypeCustom 起作用。
UIButton *replyBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];