원하는 모양을 얻기 위해 사용자 지정 셀을 그리는 중입니다. 그러나 셀을 선택하면 다른 드로잉을 수행하려고합니다. 나는 단지 기본 색상을 원하지 않는다. 주로는 악세사리 그냥 액세서리 표시 될 때까지 색 고려하지 않았다사용자 지정 셀 선택
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
그러나, 그냥 제대로 나타나지 않았다
나는 내용의 견해 배경색이 방법에서보기를 변경했습니다. 이 작업을 수행하는 더 좋은 방법이 있습니까?- (void)drawRect:(CGRect)rect
{
CGContextRef context = UIGraphicsGetCurrentContext();
// Background
CGContextSetFillColorWithColor(context, CELL_BACKGROUND_COLOR);
CGContextMoveToPoint(context, 0.0f, 0.0f);
CGContextAddLineToPoint(context, rect.size.width, 0.0f);
CGContextAddLineToPoint(context, rect.size.width, rect.size.height);
CGContextAddLineToPoint(context, 0.0f, rect.size.height);
CGContextClosePath(context);
CGContextFillPath(context);
// Top line
CGContextSetStrokeColorWithColor(context, CELL_TOP_LINE_COLOR);
CGContextSetLineWidth(context, CELL_LINE_WIDTH);
CGContextSetLineCap(context, kCGLineCapSquare);
CGContextMoveToPoint(context, 0.0f, 0.0f);
CGContextAddLineToPoint(context, rect.size.width, 0.0f);
CGContextStrokePath(context);
//Bottom line
CGContextSetStrokeColorWithColor(context, CELL_BOTTOM_LINE_COLOR);
CGContextSetLineWidth(context, CELL_LINE_WIDTH);
CGContextSetLineCap(context, kCGLineCapSquare);
CGContextMoveToPoint(context, 0.0f, rect.size.height);
CGContextAddLineToPoint(context, rect.size.width, rect.size.height);
CGContextStrokePath(context);
}
나는 화면을 전환 할 때 그러나, 세포가 동일한 색상을 변경할 것을 시도하고,이 – Vikings
당신에 의해 선택된 셀의 다시 그리기를 강제로 시도해 봤어 처리 할 수있는 효율적인 방법을 생각할 수 없다 어쩌면 - 아마도 setNeeds를 사용하여 선택한 셀에 표시 할 수 있습니다. 그냥 제안. – tiguero
예,이 방법의 문제점은 셀을 선택하고 선택한 지점에서 손가락을 떼지 만 화면에서 손가락을 뽑을 때까지 셀이 강조 표시되지 않습니다. 주변에 길이 있는지 확실하지 않습니다. – Vikings