草庐IT

TableView

全部标签

ios - 在 editActionsForRowAt 返回 [ ] 后未调用 UITableView 滑动

我一直在使用editActionsForRowAt创建内置的向左滑动功能以显示快速访问按钮,如下所示:functableView(_tableView:UITableView,editActionsForRowAtindexPath:IndexPath)->[UITableViewRowAction]?{print("Isthisworking?")//CodetocreateUITableViewRowActionbuttonsreturn[button1,button2]}functableView(_tableView:UITableView,canEditRowAtindexP

ios - Swift:Tableview 在导航栏下滚动但在状态栏上滚动?

我使用以下技巧隐藏了导航栏的阴影:self.navigationController?.navigationBar.setBackgroundImage(UIImage(),for:.default)self.navigationController?.navigationBar.shadowImage=UIImage()我还有以下一套:self.extendedLayoutIncludesOpaqueBars=trueself.automaticallyAdjustsScrollViewInsets=trueself.tabBarController?.tabBar.isHidden

ios - UITableViewCell 不显示数据 - Swift Playgrounds

我一直在尝试在我在swiftplaygroundsiPad应用程序的ViewController中创建的TableView中实现一些自定义单元格。请注意,我已经看到很多其他处理类似问题的堆栈溢出帖子,但未能找到解决我的问题的解决方案。这是我的CustomCell类:classCustomCell:UITableViewCell{letprojectImage=UIImageView()//letprojectDivider=UIView()letprojectTitle=UILabel()overridefuncawakeFromNib(){projectImage.frame=CGR

ios - 在页脚上显示行数

我想对我的应用做一件简单的事情。看看我的主ViewController:classPage1:UITableViewController{overridefuncnumberOfSections(intableView:UITableView)->Int{return1}overridefunctableView(_tableView:UITableView,numberOfRowsInSectionsection:Int)->Int{returnShared.instance.employees.count}overridefunctableView(_tableView:UITab

ios - 高亮一个 tableViewCell

我想突出显示我的tableView中的一些单元格。通过突出显示,我的意思是将单元格的背景颜色设置为蓝色,例如在复制文本时使用的颜色。我曾经尝试过这段代码来检查它是否有效publicfunctableView(_tableView:UITableView,willDisplayCellcell:UITableViewCell,forRowAtIndexPathindexPath:NSIndexPath){cell.setHighlighted(true,animated:false)}这个我也试过cell.setSelected(true,animated:false)在这两种情况下,细

ios - 围绕 UITableView 部分插入

有没有办法在一个部分周围留出间距?我知道这可以使用UICollectionView来完成。已经使用UITableView和UITableViewCells实现了所有东西,不想将东西移到UICollectionView。我正在尝试在该部分(所有侧面)周围留出空间,以便为部分(包括页眉、单元格和页脚View)提供一种整体感觉。 最佳答案 您可以使用tableView(_tableView:UITableView,viewForFooterInSectionsection:Int)和tableView(_tableView:UITable

ios - 在 tableView 中添加两个自定义单元格

我在mainStoryboard上有一个带有两个自定义单元格的tableView。我想在不同的行再设置两个单元格。但是,当我实现代码时,添加的单元格会替换原始单元格。(“基本语法3”和“基本语法5”的自定义单元格正在消失。)我试图找到答案,但找不到。我在下面添加了图片和代码。importUIKitclassHomeViewController:UIViewController,UITableViewDelegate,UITableViewDataSource{@IBOutletvartblStoryList:UITableView!vararray=PLIST.shared.mainA

ios - Swift 中静态 TableView 中特定单元格的披露指示符

我创建了一个静态TableView,我想添加或删除一个披露指示器,具体取决于我们是在咨询我们自己的帐户还是guest帐户。这就是我想要的:letindex=IndexPath(row:4,section:0)letcell=tableView.cellForRow(at:index)ifcurrentUser{cell.accessoryType=.none//cell.backgroundColor=UIColor.red}我尝试将其放入viewDidLoad函数中,但没有成功。我也尝试了cellForRowAtindexPath,结果相同。我该怎么做?

ios - UITableViewCell 列宽变化基于屏幕方向 IOS Swift

我需要在我正在开发的应用程序之一中制作下表结构。我正在使用UITableView创建此表,我需要根据屏幕方向更改表列宽度。我已经为列宽设置了限制条件,我将使用viewDidLoad()中的屏幕宽度为这些值分配值。但是,当屏幕方向发生变化时,我无法弄清楚如何重新对齐这些约束。我发现viewWillTransition()将在方向改变时被调用&我重新计算了其中的约束&为TableView调用了setNeedsLayout()。但是,当屏幕方向更改时,我无法让我的表格View重置表格列宽。我是IOS平台的新手,非常感谢任何帮助。HDR_parName/HDR_parValue/HDR_min

ios - UITableView 从当前位置滚动到底部

我怎样才能从当前位置滚动到TableView的最后一行,因为我已经尝试过这个解决方案:self.tableView.scrollToRow(at:lastIndex.last!,at:.bottom,animated:false)letnumberOfSections=self.tableView.numberOfSectionsletnumberOfRows=self.tableView.numberOfRows(inSection:numberOfSections-1)ifnumberOfRows>0{letindexPath=IndexPath(row:numberOfRows-