UIPickerView 設計每行的大小
- (CGFloat)pickerView:(UIPickerView*)pickerView rowHeightForComponent:(NSInteger)component
{
return 80.0;
}
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row
forComponent:(NSInteger)component reusingView:(UIView *)view
{
UILabel *myView = nil;
myView = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 180, 30)];
for (int i = 0; i < self.dataSource.count; ++i) {
if (i == component) {
myView.text = self.dataSource[i][row];
}
}
myView.textAlignment = NSTextAlignmentCenter;
myView.font = [UIFont systemFontOfSize:HKL_ScreenWidth * .04];
myView.backgroundColor = [UIColor clearColor];
return myView;
}
【UIPickerView 行的大小和字體大小】的相關資料介紹到這裡,希望對您有所幫助! 提示:不會對讀者因本文所帶來的任何損失負責。如果您支持就請把本站添加至收藏夾哦!