I made a custom Keyboard app with emojis some time ago for iOS 9.
After iOS 10 came out it stopped working, now only loads the bottom view.
I can't quite figure out what's wrong with my code or what change with iOS 10, I spent the last couple of days searching the web but couldn't find anything useful
Here's the code where it should load the emojis
- (void)loadNthEmoji{
[self.keyboard.imvFavorite setBackgroundImage:[UIImage imageNamed:@"btn_favorite"] forState:UIControlStateNormal];
NSInteger nTag = [defaults integerForKey:@"EMOJI_FACE_EMOJI_KIND"];
if (nTag == 0)nTag = 1;
[self setAlpha:nTag];
[self removeSubViewFromEmojiView];
CGRect rectWrapper = self.keyboard.scvEmojis.frame;
CGFloat fSpace = 4;
NSInteger nEmojiRow = 3;
CGFloat fHeight = ((rectWrapper.size.height - (nEmojiRow + 1) * fSpace) / nEmojiRow);
CGFloat fWidth = fHeight;
NSInteger nCount = [[arrCounts objectAtIndex:nTag]integerValue];
for (NSInteger i = 0 ; i < nCount; i ++){
NSInteger nRow = i % nEmojiRow;
NSInteger nColumn = i / nEmojiRow;
CGRect rectFrame = CGRectMake(fSpace + (fSpace + fWidth) * nColumn, fSpace + (fSpace + fHeight) * nRow, fWidth/1.3, fHeight/1.3);
UIImageView *imvEmoji = [[UIImageView alloc]initWithFrame:rectFrame];
imvEmoji.contentMode = UIViewContentModeScaleAspectFit;
imvEmoji.tag = 10000 * nTag + i;
[imvEmoji setImage:[UIImage imageNamed:[NSString stringWithFormat:@"ec%i (%i).png", (int)nTag, (int)i + 1]]];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tabEmoji:)];
[imvEmoji setUserInteractionEnabled:YES];
[imvEmoji addGestureRecognizer:tapGesture];
[self.keyboard.scvEmojis addSubview:imvEmoji];
}
[self.keyboard.scvEmojis setContentSize:CGSizeMake(fSpace + (fSpace + fWidth) * ((int)(nCount / nEmojiRow) + (nCount % nEmojiRow == 0 ? 0 : 1)), rectWrapper.size.height)];
[activityIndicatorView stopAnimating];
[self.keyboard.viewEmoji setHidden:NO];
}
Edit: still no luck, any help?
I got it solved by setting a new constrain for the height. In case it helps anyone with the same problem. I tried a lot of answer I found but any worked for me.