Is there any easy way to change the color of the "UITableViewCellAccessoryCheckmark" from standard blue to black? Or do i need to make a subclass of uitableviewcell and insert a imageview myself?
Thanks :-) Sebastian
As far as I know there is no way of doing this.
I ended up implementing a complete custom view for my accessoryView. It also makes it easier to change it upon user interaction and to decide the tappable area, which I often find way to small. I guess you could do with just a button if you have no need for different views.
I did a customView, placed a transparent button inside it. This view I add to the cell:
CustomDisclosureArea *disArea = [[CustomDisclosureArea alloc] init];
[disArea setFrame:CGRectMake(280.0f, 0.0f, 40.0f, 71.0f)];
[disArea setTag:DISCLOSURE_ID];
[disArea.emptyButton addTarget:self action:@selector(cellButtonHandler:event:) forControlEvents:UIControlEventTouchUpInside]; //this the button inside the view.
[cell.contentView addSubview:disArea];
[disArea switchToState:AreaStateBlank]; //I can set it to different states (blank, checkmark, empty etc.
[disArea release];
Now the method that gets called when the accessoryView is tapped is a little special because we need to know which cell was tapped.
- (void) cellButtonHandler:(id)sender event:(id)event {
NSSet *touches = [event allTouches];
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition];
}
But You end up with an NSIndexPath, which is the same as you would get in a didSelectRow or and accessoryButtonTapped method.
Hope this helps if You decide to make a custom accessoryView:)
我还没有尝试过,但它可能是可以简单地询问accessoryView
细胞的性质,并找到对号,并与其它图像替换它(这是几乎可以肯定的图像。)我认为,单元格样式只是默认风格的TableCell与带有复选标记的图像单元。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.