1.在自定義的Cell .h文件中寫出代理,寫出代理方法。atom
@protocol selectButtonDelegate <NSObject>spa
-(void)selectModelID:(NSString *)userid ;//設置須要傳遞出的數據代理
.....io
@endtable
@interface ReadBookTableViewCell : UITableViewCellclass
@property (nonatomic, assign) id<selectButtonDelegate> delegate;select
....方法
@end數據
2.點擊時間中調用代理方法tab
- (IBAction)buttonClick:(UIButton *)sender {
if ([self.delegate respondsToSelector:@selector(selectModelID:)]) {
[self.delegate selectModelID:self.userID];
}
}
3.在tableView代理方法中 實現Cell的代理;
cell.delegate = self;
4. 實現代理方法
-(void)selectModelID:(NSString *)userid{
// 執行須要執行的操做。
}