是否有任何簡單的方法將「UITableViewCellAccessoryCheckmark」的顏色從標準藍色更改爲黑色? 或者我需要做一個uitableviewcell的子類並插入一個imageview我自己?黑色的UITableViewCellAccessoryCheckmark?
感謝:-) 塞巴斯蒂安
是否有任何簡單的方法將「UITableViewCellAccessoryCheckmark」的顏色從標準藍色更改爲黑色? 或者我需要做一個uitableviewcell的子類並插入一個imageview我自己?黑色的UITableViewCellAccessoryCheckmark?
感謝:-) 塞巴斯蒂安
據我知道有沒有這樣做的方式。
我最終爲我的accessoryView實現了一個完整的自定義視圖。它還使得用戶交互時更改它更容易,並且決定可點擊區域,而這往往是我想要的方法。如果你不需要不同的觀點,我想你只需要一個按鈕即可。
我做了一個customView,在裏面放置了一個透明的按鈕。這個觀點我添加到單元格:
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];
現在,當被竊聽的accessoryView的是一個有點特殊的,因爲我們需要知道哪些細胞被竊聽所調用的方法。
- (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];
}
但你最終的NSIndexPath,這是一樣的,你會在didSelectRow或與accessoryButtonTapped方法獲得。
希望這會幫助,如果你決定做一個自定義的accessoryView的:)
非常感謝。 像這些零件讓我想知道爲什麼蘋果不吃自己的食物,並在我設置風格時填充accessoryView。 ;-) – Sebastian 2010-03-04 10:58:35