大佬教程收集整理的这篇文章主要介绍了ios – 表视图单元重新加载第一个单元格内容,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowATindexPath:(NSIndexPath *)indexPath { CellNewsInfo *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; if (!cell) { cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reusEIDentifier:@"cell"]; } // Set up the cell int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1]; NSString *titleArticle=[[stories objectATindex: storyIndex] objectForKey: @"title"]; titleArticle = [titleArticle StringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; if (indexPath.row==0) { scr=[[UIScrollView alloc] initWithFrame:CGRectMake(0,320,200)]; scr.tag = 1; scr.autoresizingMask=UIViewAutoresizingNone; [cell addSubview:scr]; [self setupScrollView:scr]; UIPageControl *pgCtr = [[UIPageControl alloc] initWithFrame:CGRectMake(120,170,80,36)]; [pgCtr setTag:12]; pgCtr.BACkgroundColor = [UIColor clearColor]; pgCtr.numberOfPages=5; pgCtr.TintColor=[UIColor redColor]; pgCtr.pageInDicatorTintColor=[UIColor blueColor]; self.pageControl.hidden=YES; pgCtr.currentPageInDicatorTintColor = [UIColor redColor]; pgCtr.autoresizingMask=UIViewAutoresizingNone; [cell addSubview:pgCtr]; } else{ cell.title.text=titleArticle; cell.title.numberOfLines=2;
为什么当我滚动它时,第一个单元格正在重新加载?我只想在初学者那里只有一次滚动视图.
@H_673_2@
如果要在一个tableView中显示多个单元格类型,或者甚至使用两个不同的单元格标识符(取决于行是否为0),则应该考虑创建自己的自定义单元格.
CellNewsInfo *cell; if (indexPath.row == 0) { cell = [tableView dequeueReusableCellWithIdentifier:@"scrollCell" forIndexPath:indexPath]; if ([cell viewWithTag:1]) { scr = [cell viewWithTag:1]; } else { scr=[[UIScrollView alloc] initWithFrame:CGRectMake(0,200)]; scr.tag = 1; } // conTinue customization here with scrollview } else { cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; // conTinue customization here without scroll view } return cell;@H_673_2@ @H_673_2@
以上是大佬教程为你收集整理的ios – 表视图单元重新加载第一个单元格内容全部内容,希望文章能够帮你解决ios – 表视图单元重新加载第一个单元格内容所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。