ios - Retrieving Uitextfiled data from Custom cell -
iam trying retreive textfield data custom cell after click button placed in last cell of index,that means table have submit button retreive data custom cell, reason placed button in xib , loaded after array count, written code this
- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section{ return [[dic_demo objectforkey:@"demo"] count]+1; } -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nsinteger lastsectionindex = [tableview numberofsections] - 1; nsinteger lastrowindex = [tableview numberofrowsinsection:lastsectionindex] - 1; nsindexpath *pathtolastrow = [nsindexpath indexpathforrow:lastrowindex insection:lastsectionindex]; if (indexpath==pathtolastrow) { // submit button through xib } else { normal custom cell textfields } }
to retreive data written code this
[mutarr_txt_tcelltext removeallobjects]; (int =0; i<[[dic_demo objectforkey:@"demo"] count]; i++) { nsindexpath *indexpath = [nsindexpath indexpathforrow:i insection:0]; customtableviewcell *cell = (customtableviewcell *)[self.tbl_sbeneficiaries cellforrowatindexpath:indexpath]; for(uiview *view in [cell.contentview subviews]) { if([view iskindofclass:[uitextfield class]]) { uitextfield *textfield = (uitextfield *)view; nslog(@"%@",textfield.text); nsstring *str_txt=[nsstring stringwithformat:@"%@",textfield.text]; nslog(@"first text %lu",(unsigned long)[str_txt length]); if ([str_txt length]>1) { [mutarr_txt_tcelltext addobject:str_txt]; } } }}
but problem not getting first indexpath tetxtfield data & remaining textfield data retreving. on this,please find screen shots
Comments
Post a Comment