草庐IT

ios - 如何快速获取 UICollectionView 中的 cell atIndex?

我正在以编程方式制作收藏View。这是viewDidLoad函数中的代码letlayout:UICollectionViewFlowLayout=UICollectionViewFlowLayout()layout.sectionInset=UIEdgeInsets(top:20,left:20,bottom:20,right:20)layout.itemSize=CGSize(width:90,height:120)collectionView=UICollectionView(frame:self.view.frame,collectionViewLayout:layout)col

uitableview - 将图像添加到单元格中

我看了很多问题,但似乎找不到答案我有一个TableView,但无法将图像添加到我的单元格中cell.imageView.image=UIImage(named:"osx_design_view_messages")这段代码应该可以工作,因为我基本上是从一个问题的答案中复制的,但由于某种原因它没有工作。有什么建议吗?我用的是swiftoverridefunctableView(tableView:UITableView!,cellForRowAtIndexPathindexPath:NSIndexPath!)->UITableViewCell!{letcellIdentifier="ce

uitableview - 将图像添加到单元格中

我看了很多问题,但似乎找不到答案我有一个TableView,但无法将图像添加到我的单元格中cell.imageView.image=UIImage(named:"osx_design_view_messages")这段代码应该可以工作,因为我基本上是从一个问题的答案中复制的,但由于某种原因它没有工作。有什么建议吗?我用的是swiftoverridefunctableView(tableView:UITableView!,cellForRowAtIndexPathindexPath:NSIndexPath!)->UITableViewCell!{letcellIdentifier="ce

ios - UITableViewAutomaticDimension 在滚动之前不工作

首次加载TableView时,所有可见单元格都是估计的行高。当我向下滚动时,单元格会自动调整大小,当我向上滚动时,最初estimatedRowHeight的单元格会自动调整大小。一旦单元格自动调整大小,它们似乎就再也不会回到估计的行高度。overridefuncviewDidLoad(){super.viewDidLoad()self.navigationItem.backBarButtonItem=UIBarButtonItem(title:"",style:.Plain,target:nil,action:nil)self.tableView.estimatedRowHeight=

ios - UITableViewAutomaticDimension 在滚动之前不工作

首次加载TableView时,所有可见单元格都是估计的行高。当我向下滚动时,单元格会自动调整大小,当我向上滚动时,最初estimatedRowHeight的单元格会自动调整大小。一旦单元格自动调整大小,它们似乎就再也不会回到估计的行高度。overridefuncviewDidLoad(){super.viewDidLoad()self.navigationItem.backBarButtonItem=UIBarButtonItem(title:"",style:.Plain,target:nil,action:nil)self.tableView.estimatedRowHeight=

UITableViewCell 不显示 detailTextLabel.text - Swift

详细信息(副标题)文本不会出现。但是,数据是可用的,因为当添加println()调用时,它会将Optional("data")与预期数据一起打印到控制台。在Storyboard中,UITableViewController设置为适当的类,TableViewCellStyle设置为“Subtitle”,重用标识符设置为“cell”。如何获取显示的字幕信息?overridefunctableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{varcell=table

UITableViewCell 不显示 detailTextLabel.text - Swift

详细信息(副标题)文本不会出现。但是,数据是可用的,因为当添加println()调用时,它会将Optional("data")与预期数据一起打印到控制台。在Storyboard中,UITableViewController设置为适当的类,TableViewCellStyle设置为“Subtitle”,重用标识符设置为“cell”。如何获取显示的字幕信息?overridefunctableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{varcell=table

uitableview - 自动布局 : Get UIImageView height to calculate cell height correctly

到目前为止,我一直只在单元格内使用文本标签,这些标签应该自动调整自己的大小。我通常对所有边缘(内容View或邻居)施加约束,并将以下行添加到我的viewDidLoad()://190.0istheactualheightofmycustomcell(seenextimage)inthestoryboardcontainingalabelandarandomlysizedUIImageViewtableView.estimatedRowHeight=190.0tableView.rowHeight=UITableViewAutomaticDimension现在,当尝试包含图像时,我遇到了

uitableview - 自动布局 : Get UIImageView height to calculate cell height correctly

到目前为止,我一直只在单元格内使用文本标签,这些标签应该自动调整自己的大小。我通常对所有边缘(内容View或邻居)施加约束,并将以下行添加到我的viewDidLoad()://190.0istheactualheightofmycustomcell(seenextimage)inthestoryboardcontainingalabelandarandomlysizedUIImageViewtableView.estimatedRowHeight=190.0tableView.rowHeight=UITableViewAutomaticDimension现在,当尝试包含图像时,我遇到了

ios - UITableViewCell 在多选时选择背景颜色

//Doesn'tworkcell.selectionStyle=.Blue//Workswhentheselectionisnotmultiple,ifit'smultiplewitheachselectionthepreviousonedisappear...letcellBGView=UIView()cellBGView.backgroundColor=UIColor(red:0,green:0,blue:200,alpha:0.4)cell.selectedBackgroundView=cellBGView任何答案如何设置所选单元格的背景颜色? 最佳