Прямо сейчас у меня есть список прокручиваемых имен пользователей, использующих представление коллекции кнопок. Но я хотел бы добавить перекрывающиеся кнопки удаления в каждую строку. Их нужно будет прикрепить к кнопкам с именами и прокручивать вместе с ними.
Как я могу добавить эти кнопки в свой CollectionView? (Также я хотел бы пропустить кнопку удаления в первой строке по понятным причинам)
Текущий код:
//Add the cells to collection
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell: UsernameCollectionViewCell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as! UsernameCollectionViewCell
cell.usernameLabel.text = userNames [indexPath.row]
return cell
}
//Upon Selecting an item
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
if (indexPath.row == 0){
self.performSegueWithIdentifier("newUserSegue", sender: self)
}
else {
sendData(userNames[indexPath.row])
self.dismissViewControllerAnimated(true, completion: nil)
}
}