আমার নিজস্ব সাবক্লাস আছে UIButton। আমি UIImageViewএটিতে যুক্ত করব এবং একটি চিত্র যুক্ত করব। আমি এটি রঙিন রঙের সাথে চিত্রের উপরে আঁকতে চাই তবে এটি কার্যকর হয় না।
এখন পর্যন্ত আমার কাছে রয়েছে:
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor clearColor];
self.clipsToBounds = YES;
self.circleView = [[UIView alloc]init];
self.circleView.backgroundColor = [UIColor whiteColor];
self.circleView.layer.borderColor = [[Color getGraySeparatorColor]CGColor];
self.circleView.layer.borderWidth = 1;
self.circleView.userInteractionEnabled = NO;
self.circleView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:self.circleView];
self.iconView = [[UIImageView alloc]init];
[self.iconView setContentMode:UIViewContentModeScaleAspectFit];
UIImage * image = [UIImage imageNamed:@"more"];
[image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
self.iconView.image = image;
self.iconView.translatesAutoresizingMaskIntoConstraints = NO;
[self.circleView addSubview:self.iconView];
...
এবং নির্বাচনের উপর:
- (void) setSelected:(BOOL)selected
{
if (selected) {
[self.iconView setTintColor:[UIColor redColor]];
[self.circleView setTintColor:[UIColor redColor]];
}
else{
[self.iconView setTintColor:[UIColor blueColor]];
[self.circleView setTintColor:[UIColor blueColor]];
}
}
আমি কি ভুল করছি? (চিত্রটির রঙ সবসময় একইরকম থাকে যেমন এটি ছিল মূলত।)


setTintColorযখন আইকনভিউ তৈরি করছেন তখন কি আপনি সক্ষম ?