Poner una imagen en un control UIPickerView

Hay que utilizar este metodo en lugar del que solo devuelve el texto.

– (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
NSString *t=@””;
UIView *tmpView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 280, 32)];
UILabel *channelLabel = [[UILabel alloc] initWithFrame:CGRectMake(30, 0, 250, 25)];
t=def.funciones[row];
UIImage *img = [UIImage imageNamed:@”Nombredelaimagen”];
UIImageView *temp = [[UIImageView alloc] initWithImage:img];
temp.frame = CGRectMake(0, 0, 25, 25);
[tmpView insertSubview:temp atIndex:0];
channelLabel.text = @”El texto que quieres”;
[channelLabel adjustsFontSizeToFitWidth];
channelLabel.textAlignment = UITextAlignmentLeft;
channelLabel.backgroundColor = [UIColor clearColor];
[tmpView insertSubview:channelLabel atIndex:0];

return tmpView;

}

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

* Please enter the Biggest Number