I have a UIView that contains a UICollectionView
, which contains custom cells. These custom cells contain a UILabel
and a UITextField
. The code for the custom cell class and the UICollectionView
one of the delegate methods is:
class DurationDayCells: UICollectionViewCell {
@IBOutlet weak var dayLabel: UILabel!
@IBOutlet weak var dayHourText: UITextField!
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return daysSet.count
}
func collectionView(collectionView: UICollectionView!,layout collectionViewLayout: UICollectionViewLayout!,sizeForItemAtIndexPath indexPath: NSIndexPath!) -> CGSize {
return CGSize(width: (self.durationCollectionView.frame.width/CGFloat(daysSet.count)), height:
self.durationCollectionView.frame.height)
}
So as you can see, these cells are dynamically created and sized according to the size of daysSet
. The problem is when I tap one of the text fields in the cells the keyboard does not pop up (the pink/red view is the said UIView
):
I also have a follow up question for when I did manage to make the keyboard show (somehow), it blocked the pink/red UIView
completely, is there a way to move the whole UIView
up when a text field is selected so the keyboard does not block it?