4.5 Using Different Types of Accessories in a Table View Cell

来源:互联网 发布:linux redis 批量删除 编辑:程序博客网 时间:2024/06/05 16:48

UITableViewCell有个accessoryType属性,你可以为其赋UITableViewCellAccessoryType中的任意值。其中有两个非常有用disclosure indicator(详情标识),和detail disclosure button(详情按钮)。他们都显示一个向右的小箭头来告诉用户,这里还有下文。他们的区别在于disclosure indicator(详情标识)并不触发事件,而detail disclosure button(详情按钮)会触发一个事件。这时拥有详情按钮行就可以触发两个事件,一个是触发cell的事件,一个触发按钮的事件。那如何来捕捉按钮事件呢?delegate那是肯定的。
- (void) tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
/* Do something when the accessory button is tapped */

}