I'm building a custom keyboard, I'm trying to recreate the iOS emoji keyboard. So I created a UICollectionView
and each cell contains an emoji (UILabel
).
But it's not scrolling smoothy. I don't know if it comes from the UICollectionView
of something else.
- Emojis are in a
plist
file, I open it inviewDidLoad
- I'm using a xib cell file for my
UICollectionViewCell
(since there is no other way with a custom keyboard) - I made a test by removing the
UILabel
from theUICollectionViewCell
and it's still not scrolling smoothy
Any clue?
EDIT
var emojis=[[String]]()
override func awakeFromNib(){
dataSource=self
delegate=self
let nib=UINib(nibName: "EmojiKeyCell", bundle: nil)
register(nib, forCellWithReuseIdentifier: cellId)
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell=collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) as! EmojiKeyCell
let emoji=emojis[indexPath.section][indexPath.item]
cell.emojiKey.text=emoji
return cell
}