Which Is the Best Way to Change the Color/View of Disclosure Indicator Accessory View in a Table View Cell in iOS

Which is the best way to change the color/view of disclosure indicator accessory view in a table view cell in iOS?

But I guess adding a new UIView object to every row might turn out to be a heavy obj allocation and decreasing the frame rate. As compared to just a UIImage object in my contentView. I believe UIImage is lighter than UIView.

Drawing an image directly will almost certainly have better performance than adding a subview. You have to determine if that extra performance is necessary. I've used a few accessory views for custom disclosure indicators on basic cells and performance was fine. However, if you're already doing custom drawing for the content rect, it might not be that difficult to do the accessory view also.

How to change color of disclosure indicator of UITableVeiw Programmatically?

Add your own disclosure indicator:

cell.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"accessory.png"]];

How to change Accessory type - Disclosure Indicator color in my cell?

You can put your image in accessoryView and your problem solved.

Sample Code
Put this code in cellForRowAtIndexPath

UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 11, 22, 22)];
imgView.contentMode = UIViewContentModeScaleAspectFit;
imgView.image = [UIImage imageNamed:@"IconMore"];
cell.accessoryView = imgView;

Sample Image

Change disclosure indicator color on cell selection

You need to use a custom accessory view for this.
Syntax:

cell.accessoryView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"accessory.png"]] autorelease];

Here you are assigning an image view with an image accessory.png

to your cell's accessory view.

Swift UITableViewCell view behind Disclosure Indicator background is not changing in bright mode

Instead of assigning color to contentView of UITableViewCell, use this

self.backgroundColor = UIColor.systemGray6

Your background color of cell will show below the accessoryType

Swift - How to change the color of an accessoryType (disclosureIndicator)?

You can do something like this

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
cell.tintColor = UIColor.white

let image = UIImage(named: "Arrow.png")
let checkmark = UIImageView(frame:CGRect(x:0, y:0, width:(image?.size.width)!, height:(image?.size.height)!));
checkmark.image = image
cell.accessoryView = checkmark

let object = objects[indexPath.row] as! NSDate
cell.textLabel!.text = object.description
return cell
}

Sample Arrow Images

Sample Image Sample Image

Output

Sample Image

Change color of accessoryType Swift

You can set your UITableViewCell tintColor property to the desired color:

[cell setTintColor:[UIColor whiteColor]];

How do i change the background color of just the accessory view (ios)?

Ok. i found a solution was to set the whole cell first (thus setting the accessory view too) and then set the content view which will be on top.

  cell.backgroundColor = [UIColor colorWithRed:255.0/255.0 green:228.0/255.0 blue:157.0/255.0 alpha:0.25];
cell.contentView.backgroundColor = [UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.25];


Related Topics



Leave a reply



Submit