
因此,对于这个,我必须使用vIEwForRow,但对于其他2,这是带标签的常见选择器,我需要TitleForRow,除非我使用vIEwForRow,TitleForRow永远不会被调用.
我怎样才能在班上打电话给两位代表?
这就是我所拥有的:
- (UIVIEw *)pickerVIEw:(UIPickerVIEw *)thePickerVIEw vIEwForRow:(NSInteger)row forComponent:(NSInteger)component reusingVIEw:(UIVIEw *)vIEw{ [[[objectPicker subvIEws] objectAtIndex:0] setHIDden:YES]; [[[objectPicker subvIEws] objectAtIndex:5] setHIDden:YES]; [[[objectPicker subvIEws] objectAtIndex:8] setHIDden:YES]; return ; //will be implemented,but this will return the icons}- (Nsstring *)pickerVIEw:(UIPickerVIEw *)pickerVIEw TitleForRow:(NSInteger)row forComponent:(NSInteger)component{ [[[objectPicker subvIEws] objectAtIndex:0] setHIDden:YES]; [[[objectPicker subvIEws] objectAtIndex:5] setHIDden:YES]; [[[objectPicker subvIEws] objectAtIndex:8] setHIDden:YES]; if (pickerVIEw == self.timePicker) { return [timeList objectAtIndex:row]; } else if(pickerVIEw == self.powerPicker) { return [powerList objectAtIndex:row]; }}解决方法 你根本不能同时拥有两个代表.解决方案是仅实现vIEwForRow:并为文本列返回UILabel对象.将label.text设置为您在textForRow中返回的字符串: 总结 以上是内存溢出为你收集整理的ios – 如何在同一个类中为不同的选择器使用viewForRow和titleForRow?全部内容,希望文章能够帮你解决ios – 如何在同一个类中为不同的选择器使用viewForRow和titleForRow?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)