Redimensionamento / escala de imagem UIButton para ajustar
Eu tenho um problema muito complicado e não sei como resolvê-lo. Estou animando um quadro de UIButtons e, quando o anime, quero que a imagem no botão seja dimensionada para o mesmo tamanho do botão. Funciona sem fazer nada no meu simulador de iPhone. Mas quando eu o executo no simulador do iPad, ele não altera o tamanho da imagem. Eu adicionei o código [[gissaImg1 imageView] setContentMode: UIViewContentModeScaleToFill] em vários lugares, mas isso não ajudou.
Alguém sabe o que está errado e como corrigir esse problema?
<code>//Code to set the image UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%@_small", [[itemsForRound objectAtIndex:[[guessItems objectAtIndex:0] intValue]] valueForKey:@"Name"]]]; [self.gissaImg1 setImage:image forState:UIControlStateNormal]; [self.gissaImg1 setImage:image forState:UIControlStateHighlighted]; //Code to animate button CGRect animateToSpot = (isIphone) ? CGRectMake(0, 0, 480, 320) : CGRectMake(0, 0, 1024, 768); [self performSelector:@selector(PlayCorrectSound:) withObject:nil afterDelay:1]; [[gissaImg1 imageView] setContentMode:UIViewContentModeScaleToFill]; [UIView animateWithDuration:1.5 delay:0 options:(UIViewAnimationOptionAllowUserInteraction | UIViewAnimationCurveLinear) animations:^{ switch (index) { case 0: [[gissaImg1 imageView] setContentMode:UIViewContentModeScaleToFill]; [self.gissaImg1 setFrame:animateToSpot]; [self.view bringSubviewToFront:gissaImg1]; break; ....... </code>