私はピッカービューが画像と共にあるアプリケーションを持っています.私はこれでそれをしました.`
picker1=[[UIPickerView alloc] init];
picker1.frame= CGRectMake(30,90,155,316);
picker1.delegate = self;
picker1.dataSource = self;
picker1.showsSelectionIndicator = YES;
picker1.tag = 1;
[self.view addsubview:picker1];
そして、viewForRowデリゲートメソッドを使用して画像をロードしています。ピッカービュー内の画像フレームを増やす必要があります。
UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"%@.png",[self.array objectAtIndex:row]]];
UIImageView *icon = [[UIImageView alloc] initWithImage:img];
//temp.frame = CGRectMake(170, 0, 30, 30);
UIView *tmpView = [[[UIView alloc] initWithFrame:CGRectMake(155,75,95,35)] autorelease];
[tmpView insertSubview:icon atIndex:0];
picker1.backgroundColor = [UIColor clearColor];
[(UIView*)[[picker1 subviews] objectAtIndex:2] setAlpha:0.0f];
[(UIView*)[[picker1 subviews] objectAtIndex:0] setAlpha:0.0f];
[(UIView*)[[picker1 subviews] objectAtIndex:1] setAlpha:0.0f];
[(UIView*)[[picker1 subviews] objectAtIndex:3] setAlpha:0.0f];
[tmpView setUserInteractionEnabled:NO];
[tmpView setBackgroundColor:[UIColor clearColor]];
[tmpView setTag:row];
return tmpView;
しかし、ビューのフレームを大きくしようとすると、サイズではなく位置が変わるだけです。誰かがこれを達成するのを手伝ってくれますか?