草庐IT

CellForRowAtIndexPath

全部标签

ios - UITableView - cellForRowAtIndexPath 延迟渲染

我有一个UITableView,它的单元格可能会有所不同,具体取决于要在每个单元格上显示的数据,所以我有两个可重复使用的单元格,UIPendingXOCell和UIXOCell。在某些时候,每个UIPendingXOCell都会变成一个UIXOCell。请参阅下面的代码了解一些上下文:overridefunctableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{varxoItem=self.xoForIndexPath(indexPath)varxoIte

ios - 永远不会调用 cellForRowAtIndexPath

我有一个包含UIViewController的Storyboard,其中包含UITableview和UITableViewCell,所有内容都已正确连接,我已经放置了所有必需的代码用于UIViewController。当我在模拟器中运行应用程序时,数据源函数之一cellForRowAtIndexPath从未被调用,但numberOfRowsInSection被调用调用“functableView(tableView:UITableView,numberOfRowsInSectionsection:Int)->Int”但是“functableView(tableView:UITableV

swift - tableView.cellForRowAtIndexPath(indexPath) 返回 nil

我有一个循环遍历我的TableView的验证函数,问题是它在某些时候返回nil单元格。forvarsection=0;section0{letcell=tableView.cellForRowAtIndexPath(indexPath)as!MyCell//cellisnilwhenself.tableView.numberOfRowsInSection(section)return3forrow1and2//...Otherstuff}}}我不太确定我在这里做错了什么,我尝试仔细检查indexPath行和部分,它们都很好,numberOfRowsInSection()返回3但第1行和

ios - 未从自定义类调用 cellForRowAtIndexPath

我正在使用Xcode7.0、Swift2我主要是尝试创建一个自定义类来构建一个UITable,然后在ViewController中创建一个新的表对象并将其加载到自身中.View;我遇到的问题是函数functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell根本没有从自定义类中调用。我已经寻找解决方案3天了,我已经尝试过多次重建应用程序和代码,但都没有成功。请注意,如果我在ViewController.swift文件中使用相同的代码(即构建表所需的一切;不包

ios - 在 UITableView IOS 中选择行时的多个复选标记

我有一个UITableView,它会在选中一行时显示复选标记。问题是,当我在didSelectRowAtIndexPath中选择一行并在所选行上添加复选标记时,它会添加一个额外的复选标记。这是我的代码非常感谢任何帮助。-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{UITableViewCell*cell=[tableViewdequeueReusableCellWithIdentifier:@"Cell"forIndexPath:inde

ios - 在 UITableView IOS 中选择行时的多个复选标记

我有一个UITableView,它会在选中一行时显示复选标记。问题是,当我在didSelectRowAtIndexPath中选择一行并在所选行上添加复选标记时,它会添加一个额外的复选标记。这是我的代码非常感谢任何帮助。-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{UITableViewCell*cell=[tableViewdequeueReusableCellWithIdentifier:@"Cell"forIndexPath:inde

ios - 将按钮添加到 UITableViewCell 的附件 View

目标:当用户选择一个单元格时,将向该单元格添加一个按钮。在我的didSelectRowAtIndexPath函数中,我有以下内容:UIButton*downloadButton=[[UIButtonalloc]init];downloadButton.titleLabel.text=@"Download";[downloadButtonsetFrame:CGRectMake(40,0,100,20)];[[self.tableViewcellForRowAtIndexPath:indexPath].accessoryViewaddSubview:downloadButton];[[se

ios - 将按钮添加到 UITableViewCell 的附件 View

目标:当用户选择一个单元格时,将向该单元格添加一个按钮。在我的didSelectRowAtIndexPath函数中,我有以下内容:UIButton*downloadButton=[[UIButtonalloc]init];downloadButton.titleLabel.text=@"Download";[downloadButtonsetFrame:CGRectMake(40,0,100,20)];[[self.tableViewcellForRowAtIndexPath:indexPath].accessoryViewaddSubview:downloadButton];[[se

未调用 UITableView 方法 cellForRowAtIndexPath

我的UITableView没有显示任何数据。我认为问题出在:overridefunctableView(tableView:UITableView!,cellForRowAtIndexPathindexPath:NSIndexPath?)->UITableViewCell?`这是我的代码:overridefunctableView(tableView:UITableView!,cellForRowAtIndexPathindexPath:NSIndexPath?)->UITableViewCell?{//Configurethecell...letcellId:NSString="Ce

未调用 UITableView 方法 cellForRowAtIndexPath

我的UITableView没有显示任何数据。我认为问题出在:overridefunctableView(tableView:UITableView!,cellForRowAtIndexPathindexPath:NSIndexPath?)->UITableViewCell?`这是我的代码:overridefunctableView(tableView:UITableView!,cellForRowAtIndexPathindexPath:NSIndexPath?)->UITableViewCell?{//Configurethecell...letcellId:NSString="Ce