0
我有以下代码。UIColor colorWithPatternImage更改图像的颜色
//Create a view to place repeated arrow in.
UIView *rootView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 60)];
//Add Repeated Arrows to the top of the view using a color pattern.
UIImage *arrowImage = [UIImage imageNamed:@"arrow-down"];
UIColor *repeatedArrowColor = [UIColor colorWithPatternImage:arrowImage];
CGRect repeatedArrowFrame = CGRectMake(0, 0, 320.0, [arrowImage size].height);
UIView *repeatedArrowView = [[UIView alloc] initWithFrame:repeatedArrowFrame];
[repeatedArrowView setBackgroundColor:repeatedArrowColor];
[rootView addSubview:repeatedArrowView];
正在使用的图像是带有颜色箭头的png#323232。我通过右键单击.app文件并选择显示包装内容来验证这一点。
然而,当图案的iPhone模拟器屏幕上显示的箭头的颜色是#262626或#252525。
有没有人遇到这个问题?如果是这样,你是如何解决问题的,或者你是否解决了这个问题?
谢谢你的回答。我从来没有遇到过这个问题。可能是因为我已经离开了Apple的Compress PNGs选项,或者在使用png之前应用了ImageOptim。 – Tobias
只是好奇 - 你是如何得到你想要的价值的? –
那么,在你回复之前,我已经停止使用png了。相反,我使用CoreGraphics绘制单个箭头,然后将其用作模式的基础。 – Tobias