ios - how to enable UITextField userinteraction property inside UITableView Cell -


i have uitableviewcell , inside have uitextfield, made 7 sections (dynamic) , each section have 1 cell (one row) includes uitextfield .

now have 1 button on right top corner of uinavigationbar (edit button). need enable user interaction enable section textfields . hows possible?

this uitableviewcode

- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     sharedmanager=[mymanager sharedmanager];     return 1; } - (uitableviewcell *)tableview:(uitableview *)tableview          cellforrowatindexpath:(nsindexpath *)indexpath {     //uitableviewcell *cell;     uilabel *label = nil;     nsstring *text;     cell = [tableview dequeuereusablecellwithidentifier:@"cell"];     if (cell == nil)     {         cell = [[timelinedetailscell alloc] initwithframe:cgrectzero reuseidentifier:@"cell"];          label = [[uilabel alloc] initwithframe:cgrectzero];         [label setlinebreakmode:uilinebreakmodewordwrap];         [label setminimumfontsize:font_size];         [label setnumberoflines:0];         [label setfont:[uifont systemfontofsize:font_size]];         [label settag:1];          [[label layer] setborderwidth:2.0f];          [[cell contentview] addsubview:label];      }      if(indexpath.section==0){         text = [contents objectatindex:0];     }else if(indexpath.section==1){         text = [contents objectatindex:1];     }else if(indexpath.section==2){         text = [contents objectatindex:2];     }else if(indexpath.section==3){         text = [contents objectatindex:3];     }else if(indexpath.section==4){         text = [contents objectatindex:4];     }else if(indexpath.section==5){         text = [contents objectatindex:5];     }else if(indexpath.section==6){         text = [contents objectatindex:6];     }else if(indexpath.section==7){         text = [contents objectatindex:7];     }      cgsize constraint = cgsizemake(cell_content_width - (cell_content_margin * 2), 20000.0f);      cgsize size = [text sizewithfont:[uifont systemfontofsize:font_size] constrainedtosize:constraint linebreakmode:uilinebreakmodewordwrap];      if (!label)         label = (uilabel*)[cell viewwithtag:1];      [cell.ds1 settext:text];     [cell.ds1 setframe:cgrectmake(cell_content_margin, cell_content_margin, cell_content_width - (cell_content_margin * 2), max(size.height, 44.0f))];      return cell;  } - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath; {     nsstring *text ;     if(indexpath.section==0){         text = [contents objectatindex:0];     }else if(indexpath.section==1){         text = [contents objectatindex:1];     }else if(indexpath.section==2){         text = [contents objectatindex:2];     }else if(indexpath.section==3){         text = [contents objectatindex:3];     }else if(indexpath.section==4){         text = [contents objectatindex:4];     }else if(indexpath.section==5){         text = [contents objectatindex:5];     }else if(indexpath.section==6){         text = [contents objectatindex:6];     }else if(indexpath.section==7){         text = [contents objectatindex:7];     }       cgsize constraint = cgsizemake(cell_content_width - (cell_content_margin * 2), 20000.0f);      cgsize size = [text sizewithfont:[uifont systemfontofsize:font_size] constrainedtosize:constraint linebreakmode:uilinebreakmodewordwrap];      cgfloat height = max(size.height, 44.0f);      return height + (cell_content_margin * 2); }  - (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:(nsinteger)section {     nsstring *str= [title objectatindex:section];     return str; } 

my edit button code

-(void)edittimeline{     cell.ds1.userinteractionenabled=yes;     [cell.ds1 setuserinteractionenabled:true];     cell.ds1.layer.bordercolor=[uicolor lightgraycolor].cgcolor;     cell.ds1.layer.borderwidth=1;   //  [cell.ds1 becomefirstresponder];  } 

when click on edit button rows able edit .please me .

define flag data memeber bool type  -(void)edittimeline{     flag=true;      [self.tableview reload]; }   add following condition in cellforrowatindexpath method   if(flag==true){  [cell.ds1 setuserinteractionenabled:true]; } else{  [cell.ds1 setuserinteractionenabled:no]; }  let me know if u....!!! 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -