ios - Add UIPickerView inside UITableview -
how can add uipickerview inside uitableviewcell?
is there new inlinepicker or try add subview in cell?
please answer question & remove confusion/doubt inlinepicker
apple has given sample code datecell
here code snippet of :
- (bool)haspickerforindexpath:(nsindexpath *)indexpath { bool hasdatepicker = no; nsinteger targetedrow = indexpath.row; targetedrow++; uitableviewcell *checkdatepickercell = [self.tableview cellforrowatindexpath:[nsindexpath indexpathforrow:targetedrow insection:0]]; uidatepicker *checkdatepicker = (uidatepicker *)[checkdatepickercell viewwithtag:kdatepickertag]; hasdatepicker = (checkdatepicker != nil); return hasdatepicker; } - (void)updatedatepicker { if (self.datepickerindexpath != nil) { uitableviewcell *associateddatepickercell = [self.tableview cellforrowatindexpath:self.datepickerindexpath]; uidatepicker *targeteddatepicker = (uidatepicker *)[associateddatepickercell viewwithtag:kdatepickertag]; if (targeteddatepicker != nil) { nsdictionary *itemdata = self.dataarray[self.datepickerindexpath.row - 1]; [targeteddatepicker setdate:[itemdata valueforkey:kdatekey] animated:no]; } } } - (bool)hasinlinedatepicker { return (self.datepickerindexpath != nil); } - (bool)indexpathhaspicker:(nsindexpath *)indexpath { return ([self hasinlinedatepicker] && self.datepickerindexpath.row == indexpath.row); } - (bool)indexpathhasdate:(nsindexpath *)indexpath { bool hasdate = no; if ((indexpath.row == kdatestartrow) || (indexpath.row == kdateendrow || ([self hasinlinedatepicker] && (indexpath.row == kdateendrow + 1)))) { hasdate = yes; } return hasdate; }
Comments
Post a Comment