objective-c - 如何从table向cell中传值?
仅有的幸福
仅有的幸福 2017-04-28 09:06:11
0
1
741

问题是这样的,我现在想往自定义cell中传入几个判断条件,用以判断是否添加图片标签等等,请问能否在返回cell时添加用属性给cell中传值

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
            {
                tabelViewCell1 *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
                NSDictionary *dic = _arr[indexPath.row];
                cell.name.text = dic[@"userinfo"][@"uname"];
                [cell.imgView sd_setImageWithURL:[NSURL URLWithString:dic[@"userinfo"][@"icon"]]];
                cell.songId = @"ddd";
                return cell;
            }

songId并不能传进cell中

仅有的幸福
仅有的幸福

reply all(1)
Ty80

Have you defined songId in tabelViewCell1? Check to see if there is a problem elsewhere in the code.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!