0
我想在我的項目中自定義選取器視圖。在pickerview單元格中添加不同類型的圖像&也希望降低pickerview
高度。如何自定義選取器視圖
我向你展示圖像以獲得更多理解。
請幫助我。 如何實現這種類型的pickerview.I檢查自定義演示,但我沒有找到
我想在我的項目中自定義選取器視圖。在pickerview單元格中添加不同類型的圖像&也希望降低pickerview
高度。如何自定義選取器視圖
我向你展示圖像以獲得更多理解。
請幫助我。 如何實現這種類型的pickerview.I檢查自定義演示,但我沒有找到
將條件應用於UIPickerView的委託方法。
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"your image number %@.png", (long)row]];
UIImageView *imageview= [[UIImageView alloc] initWithImage:img];
imageview.frame = CGRectMake(-70, 10, 60, 40);
UILabel *channelLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, -5, 80, 60)];
channelLabel.text = [NSString stringWithFormat:@"%@", [myArray objectAtIndex:row]];
channelLabel.textAlignment = UITextAlignmentLeft;
channelLabel.backgroundColor = [UIColor clearColor];
UIView *tmpView_row = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 110, 60)];
[tmpView_row insertSubview:imageview atIndex:0];
[tmpView_row insertSubview:channelLabel atIndex:1];
return tmpView_row;
}