2011-05-23 52 views

回答

15

在揀貨機的數據委託實施viewForRow:forComponent:方法,它創建的UILabel實例與字體(和所有其他屬性),你需要,如:

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{ 
    UILabel* tView = (UILabel*)view; 
    if (!tView){ 
     tView = [[UILabel alloc] init]; 
      // Setup label properties - frame, font, colors etc 
      ... 
    } 
    // Fill the label text here 
    ... 
    return tView; 
} 
+0

真正的幫助感謝隊友... :) – 2011-05-23 11:08:35

+0

@Vladimir:這真的很有幫助,加了+1。但我有一個問題。是否有什麼擔心HIG做這個定製?因爲我已經在2010年早些時候的回答中展示過了。如果有任何情況,請告訴我。 – Nit 2012-05-11 11:29:26

+0

@恩,是的,它是什麼? – Vladimir 2012-05-11 11:30:07

-1

PickerView.transform = CGAffineTransformMakeScale(0.4,0.4);

+1

-1這使得整個UIPickerView小 – Jasper 2013-04-11 11:19:55