

—————
SimpleTableView.h :

—————
SimpleTableView.m :

—–
在 cellForRowAtIndexPath 加段 code :
// --- 每個 cell 前加上 一個 icon
UIImage *image = [UIImage imageNamed:@"favicon.ico"];
cell.imageView.image = image;
// 加上一個往下 點擊 的標示
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
//
—–
加上 user 點擊 cell 時的 event :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *stateSelected = [listdata objectAtIndex:[indexPath row]];
NSString *msg = [[NSString alloc] initWithFormat:@"You have selected %@ , # %i", stateSelected, [indexPath row] ];
NSLog(@"%@",msg );
}
