作者zonble (zonble)
看板MacDev
標題Re: [問題] UIPickerView 改變外觀
時間Tue Aug 4 08:40:50 2009
※ 引述《myrainbow (Cindy)》之銘言:
: BTW..
: picker的內容值可不可以置中?
像這樣實作 delegate 就是置中的。
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
UILabel *label = nil;
if (view) {
label = (UILabel *)view;
}
else {
label = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 300, 40)] autorelease];
}
label.backgroundColor = [UIColor clearColor];
label.text = @"Test"; // Replace it with what you want.
label.font = [UIFont boldSystemFontOfSize:26.0];
label.textAlignment = UITextAlignmentCenter;
label.textColor = [UIColor blackColor];
return label;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.42.194.167
※ 編輯: zonble 來自: 220.128.103.143 (08/04 16:43)