IOS笔记5

UIpickerView的可重用

 1 - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
 2 {
 3     
 4     NJCountryView *countryView = (NJCountryView *)view;
 5 
 6     if (countryView == nil) {
 7         NSLog(@"创建新的自定义view");
 8         countryView = [NJCountryView countryView];
 9     }
10     
11     // 2.赋值模型数据
12     countryView.country = self.countrys[row];
13     
14     // 3.返回自定义view
15     return countryView;
16 }

 

posted @ 2015-04-17 20:48  liqiantu  阅读(121)  评论(0编辑  收藏  举报