草庐IT

rnn_cell

全部标签

ios - 静态方法中的 UIAlertController 给出错误 : extra argument animated in cell

我希望创建一个静态方法,我可以将其放置在实用程序类中,该实用程序类将启动UIAlertController。但是,我收到以下错误:"extraargumentanimatedincell"staticfuncsimpleAlertBox1(msg:String)->Void{letalertController=UIAlertController(title:"Alert!",message:msg,preferredStyle:.actionSheet)letdefaultAction=UIAlertAction(title:"OK",style:.default,handler:n

ios - UITableViewCell didSelectRowAt : not getting called when press on UIButton area in cell

我添加了带有复选框图像的UIButton(用于项目中的某些功能要求。)。复选框图像选择和取消选择在UITableViewCell上正常工作点击但如果我点击复选框按钮区域按钮图像上的单元格不会改变。我的意思是didSelectRowAt方法没有调用。 最佳答案 我找到了解决方案。我检查过UIButton的UserInteraction忽略了UITableViewCell的点击。所以我刚刚在我的代码中添加了下面一行。细胞分流器工作正常。cell.btnCheck.isUserInteractionEnabled=false

ios - Cell 中只有第一个 UILabel,更新了 UICollectionView - Swift

我正在尝试更新存在于我的UICollectionView单元格上的UILabel。虽然我遇到的问题是只有第一个单元格用新字符串更新我首先尝试将IBOutlet连接到Cell中的UILabel,但是遇到了这个问题:Main.storyboard:error:IllegalConfiguration:Connection"name"cannothaveaprototypeobjectasitsdestination.接下来,我尝试使用标签-但是使用这种方法,只有一个UICollectionView单元格得到更新。//MARK:UICollectionViewDataSourceoverri

swift - ios8/swift : Buttons inside UICollectionView Cell?

我正在尝试使用CollectionView将“上传图像”的预览构建到服务器,但不知何故我被删除了——或者更准确地说,如何正确连接单元格内的按钮?单击X(单元格内的一个按钮)时,用户应该从属于其父ViewController的上传数组中删除此UIImage。您应该在自定义单元格类中还是在普通ViewController中处理IBAction单击?正确的做法是什么?您应该根据索引在按钮上使用标签,然后删除图像@index还是应该将整个数组移交给单元格并在点击后返回? 最佳答案 假设按钮的TouchUpInside事件连接到下面的函数。f

ios - Swift 4.2 UITableView Cell 不会自动改变它的高度

我在自动调整单元格高度时遇到问题。单元格中有一个UILabel,它有一个很长的文本。但是,它是不可见的,因为单元格不会自动变大。importUIKitclassViewController:UIViewController{@IBOutletweakvartableView:UITableView!overridefuncviewDidLoad(){super.viewDidLoad()//Doanyadditionalsetupafterloadingtheview,typicallyfromanib.tableView.estimatedRowHeight=50tableView.

iOS Collection View : how to scroll a cell to the top of the screen

我想知道是否有办法将某个UICollectionViewCell滚动到View的顶部?我尝试了collectionView.scrollToItemAtIndexPath()方法,但不是将单元格滚动到View的顶部,而是将单元格滚动到View的中心。 最佳答案 您可以使用以下代码:#pragmamark-UICollectionViewDelegate-(void)collectionView:(UICollectionView*)collectionViewdidSelectItemAtIndexPath:(NSIndexPath

ios - "unable to dequeue a cell with identifier"当切换到编程转换而不是 segue 时

我有2个View,一个里面有一个按钮的主视图,一个表格View。TableView单元格具有标识符“ResultsTableViewCell”。我的目标是当我按下主视图上的按钮时,我会转换到表格View当我使用Storyboardsegue时,一切正常。但是,当我取出segue而不是为按钮分配一个Action以编程方式进行转换时,我得到了提到的错误。这是为什么?代码如下:ViewController.swift(这是我进行任何更改的唯一文件)classViewController:UIViewController{overridefuncviewDidLoad(){super.view

ios - swift 3 : Resizing UICollectionViewCell programmatically causes cells to overlap

我正在尝试创建一个UICollectionView,其中3个单元格彼此下方。这工作正常。当我触摸一个单元格时,这个单元格应该展开,其他单元格应该折叠到特定高度。也工作得很好。我无法解决的问题;当我点击一个单元格时,它会像我想要的那样展开;它与下面的重叠。下面的那个不会向下移动来为这个单元格的新高度腾出空间。我该如何解决这个问题?这是我到目前为止与UICollectionView和UICollectionViewCell相关的内容/***Tempory3items*/funccollectionView(_collectionView:UICollectionView,numberOfI

ios - swift : UITableViewCell separator for the first the cell only

我想显示不带分隔符的评论,如下图所示我尝试使用分隔符但它不起作用我只需要第一个单元格的分隔符。super.viewDidLoad()self.commentstableView.separatorColor=UIColor.clearColor()functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{//post'ssection==0ifindexPath.section==0{letcell=tableView.dequeueReusableC

ios - 从自定义 Cell 中正确委托(delegate)按钮操作以删除 UITableView 中的行

仍然是一个Swift菜鸟,我一直在寻找一种正确的方法/最佳实践来管理我的UITableView(使用自定义UserCell)中的行删除基于使用委托(delegate)在UserCell中点击UIButton,这似乎是最简洁的方法。我按照这个例子:UITableViewCellButtonswithaction我有什么UserCell类protocolUserCellDelegate{funcdidPressButton(_tag:Int)}classUserCell:UITableViewCell{vardelegate:UserCellDelegate?letaddButton:UI