首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

ios cell 与tableview其间传参数block方式

2014-01-22 
ios cell 与tableview之间传参数block方式??cell里面typedef void(^ TouXiang)(NSString *) // 文章ID?@p

ios cell 与tableview之间传参数block方式

?

?

cell里面

typedef void(^ TouXiang)(NSString *); // 文章ID

?

@property (nonatomic, copy) TouXiang myTouXiang;? ? // 传文章ID的Block

-(void)tapAction{

? ? NSLog(@"点击了头像。");

? ? self.myTouXiang(@"1");

?

}

?

tablvew 里面:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

? ? static NSString *cellIdentifier = @"cell";

? ? Comment_Cell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

? ? if (cell == nil) {

? ? ? ? cell = [[Comment_Cellalloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:cellIdentifier];

? ? }

?? ?

?? ?

? ? ///最好放在这里。。。

? ? cell.myTouXiang = ^(NSString *tempS){

? ? ? ? if (self.isMyComment) {

? ? ? ? ? ? MyCommentModel *myCommentModel = _myComment_dataArr[indexPath.row];

? ? ? ? ? ? self.articl_id = myCommentModel.comment_id;

? ? ? ? ? ? self.pinglunID = myCommentModel.cmted_user_id;

? ? ? ? } else {

? ? ? ? ? ? CommentMe *commentMeModel = _commentMe_dataArr[indexPath.row];

? ? ? ? ? ? self.articl_id = commentMeModel.comment_id;

? ? ? ? ? ? self.pinglunID = commentMeModel.cmt_user_id;

? ? ? ? }

? ? ? ? MySendOutViewController *sendVC = [[MySendOutViewControlleralloc]init];

? ? ? ? sendVC.friend_user_id = self.pinglunID;

? ? ? ? [self.viewController.navigationControllerpushViewController:sendVC animated:YES];

?? ? ? ?

?

? ??};

热点排行