草庐IT

IndexPath

全部标签

xcode - 如何在 UITableViewCell 中添加多行

我目前正在使用Swift开发一个将数据存储到表中的应用程序。目前我对正文下的字幕文本有疑问。我想在“许可证号”下添加几行字幕,请引用图片。I.我已准备好一切,但不确定如何使其可见。任何帮助将不胜感激functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{letcell:UITableViewCell=UITableViewCell(style:UITableViewCellStyle.Value2,reuseIdentifier:"Nil")cell

ios - 如何从 tableview 单元格中检索文本字段值

我有一个包含2个单元格的表格View。两个单元格都有一个文本字段和一个标签。文本字段采用用户名/电子邮件地址和密码的值。varemailAddress:String?varpassword:String?functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{letcell=tableView.dequeueReusableCellWithIdentifier(cellID)as!TextFieldCellcell.label.text=loginO

ios - Swift Collection View自定义布局更改单元格侧的单元格宽度

你好,我有工作的collectionview自定义布局代码,但我需要从json动态更改单元格端的单元格宽度。我的CustomCollectionViewLayoutimportUIKitpublicvarCELL_HEIGHT=22.0publicvarCELL_WIDTH=40.0//HEREWIDTHSOMECELLSMUSTBE80classCustomCollectionViewLayout:UICollectionViewLayout{//UsedforcalculatingeachcellsCGRectonscreen.//CGRectwilldefinetheOrigin

ios - Collection View cellForItemAt indexPath 未被调用(Swift)

我从Storyboard创建了一个CollectionViewController,并将其自定义类设置为ItemCollectionVC,将其单元格的自定义类设置为ItemCell,并将其重用标识符设置为单元格这是我的ItemCollectionVC类:importUIKitprivateletreuseIdentifier="Cell"classItemCollectionVC:UICollectionViewController{vardataSourceItems:[Items]=[]varcounterBuildItems:[Items]{letweaponItemArray=

ios - UITableView 重复单元格(带有文本字段的自定义单元格)

我花了好几天时间来解决这个问题,在尝试了很多之后我在这里问了一个问题。我正在使用自定义UITableViewCell,并且该单元格包含UITextFields。在将新单元格添加到表格View时,表格View表现异常,就像它复制单元格一样,当我尝试编辑新单元格的文本字段时,前一个单元格的文本字段也会被编辑。复制的行为如下:第一个单元格被复制到第三个单元格。我不知道这是由于细胞的可重用性,但谁能告诉我有效的解决方案?我附上了UITableViewCell的屏幕截图。cellForRow的代码如下:functableView(_tableView:UITableView,cellForRow

ios - 'NSInternalInconsistencyException'试图为同一索引路径使多个单元格出列,这是不允许的

我的应用程序崩溃了Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'Attemptedtodequeuemultiplecellsforthesameindexpath,whichisnotallowed.Ifyoureallyneedtodequeuemorecellsthanthetableviewisrequesting,usethe-dequeueReusableCellWithIdentifier:method(withoutanindexpath).当我尝试重新加载我

ios - 仅为一种单元格类型设置单元格高度并为其他单元格保留动态高度

我有一个带有单元格动态高度的UITableView。但是,我想为一种特定的单元格类型分配固定的高度。我的代码如下:functableView(tableView:UITableView,heightForRowAtIndexPathindexPath:NSIndexPath)->CGFloat{ifindexPath.section==1&&indexPath.row==0{guardletanswerType=question.answerTypeelse{return//Whatvaluehere?}ifanswerType==.Text{returntableView.frame

ios - UITableViewCell 快速重复每 12 行

使用以下代码,当我单击一个单元格以创建复选标记配件时,它会每12行重复复选标记。关于原因有什么想法吗?functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{letcell=tableView.dequeueReusableCellWithIdentifier("Cell",forIndexPath:indexPath)as?UITableViewCellcell?.textLabel="\(indexPath.row)"returncell!}fu

ios - 使用 editActionsForRowAt IndexPath 删除一行 "UITableView internal bug"

我需要在editActionsForRowAtIndexPath中创建一个操作来删除表中的一行。在互联网上进行一些研究后,我得出了这段代码:functableView(tableView:UITableView,editActionsForRowAtIndexPathindexPath:NSIndexPath)->[UITableViewRowAction]?{letremove=UITableViewRowAction(style:UITableViewRowActionStyle.Destructive,title:"Remover",handler:{(action:UITabl

ios - : tableView. cellForRow 和 dataSource.cellForRowAtIndexPath 之间的区别

目前我正在做一个项目和开始的开发人员用于访问单元格的项目dataSource.cellForRowAtIndexPath(indexPath)但我习惯于使用访问单元格cellForRow(at:indexPath)有谁知道其中的区别,哪个更好用?我问的原因是dataSource.cellForRowAtIndexPath(indexPath)导致了我们这次崩溃。***Terminatingappduetouncaughtexception'NSInternalInconsistencyException',reason:'Attemptedtodequeuemultiplecellsf