简体   繁体   English

如何删除在UI-C中用红色填充图像的UIColor

[英]How to remove UIColor that fills image in the red color in Objective-C

dear developers. 亲爱的开发人员。 I am reskinning an existing objective-c code (Xcode 8 project) and I run into an issue that all png images are automatically painted with red color, so I can't see any real look of the images when running an app in Simulator and on the real device. 我正在重新着色现有的Objective-C代码(Xcode 8项目),并且遇到一个问题,所有png图像都自动涂成红色,因此在Simulator中运行应用程序时,我看不到图像的任何真实外观,并且在真实设备上。

I tried to use UIColor clearColor instead of UIColor redColor, but image just disappears. 我尝试使用UIColor clearColor代替UIColor redColor,但是图像只是消失了。

How can I just show images "as is" with no color overlay at all? 我如何仅按原样显示图像而完全没有颜色覆盖?

Thank you very much for your help! 非常感谢您的帮助!

UIButton *temp = [UIButton buttonWithType:UIButtonTypeCustom];
        temp.tag = 0;
        [self collectionClose:temp];

        CGFloat width, height;
        CGFloat centerX = _canvas.frame .size.height/2.0, centerY = _canvas.frame.size.width/2.0;
        UIImage *image = [self imageNamed:[NSString stringWithFormat:@"Pack%ld%@_%zd.png", (long)packID, currentCollection, indexPath.row+1]
                              withColor:[UIColor redColor]];    

I seen your code and there you have clearly written that button color red. 我看到了您的代码,在这里您清楚地将按钮颜色写成红色。 The method which you have written is wrong. 您编写的方法是错误的。 [UIButton setImage:[UIImage imageNamed:@"image.png"]]. [UIButton setImage:[UIImage imageNamed:@“ image.png”]]。

This will show image in button. 这将在按钮中显示图像。

UIButton *temp = [UIButton buttonWithType:UIButtonTypeCustom];
temp.tag = 0;
[self collectionClose:temp];

CGFloat width, height;
CGFloat centerX = _canvas.frame .size.height/2.0, centerY = _canvas.frame.size.width/2.0;

NSString *imageName = [NSString stringWithFormat:@"Pack%ld%@_%zd.png", (long)packID, currentCollection, indexPath.row+1];
[temp setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM