objective c - Drop Down issue in not showing the data from Array in IOS -


i have drop down buttons in view controller in when click shows countries , when select country , click cities button shows respective cities of country in drop down. have button having drop down in when click shows 3 option home,plotand commercial when click home after selecting under button shows options behind home button in drop down , whenever select option home, plot , commercial shows option of commercial in dropdown under , code looking fine not showing option of home , plot. code,

- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {      if (tableview == table1)         return [data count];     else if (tableview == table2)         return [data1 count];     else if (tableview == table3)         return [data2 count];     else if (tableview == table4)         return [data3 count];     else if (tableview == table5){         return [data4 count];     }     else {         return [data5 count];     }  }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      static nsstring *cellidentifier = @"cell";      uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier];      if (cell == nil) {         cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier];     }      if (tableview == table1) {         cell.textlabel.text = [data objectatindex:indexpath.row];     }else if (tableview == table2){         cell.textlabel.text = [data1 objectatindex:indexpath.row];      }else if (tableview == table3){         cell.textlabel.text=[data2 objectatindex:indexpath.row];     }else if (tableview == table4){         cell.textlabel.text=[data3 objectatindex:indexpath.row];      }else if (tableview == table5){         cell.textlabel.text=[data4 objectatindex:indexpath.row];     }     else if(tableview == table6){          cell.textlabel.text=[data5 objectatindex:indexpath.row];     }      return cell; }  - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {      uitableviewcell *selectedcell=[tableview cellforrowatindexpath:indexpath];      if (tableview == table1) {         [self.but1 settitle:[nsstring stringwithformat:@"%@",selectedcell.textlabel.text] forstate:uicontrolstatenormal];         if ([selectedcell.textlabel.text isequaltostring:@"pakistan"]) {             data1=[[nsarray alloc]initwitharray:pak_city];         }else if ([selectedcell.textlabel.text isequaltostring:@"uae"]){             data1=[[nsarray alloc]initwitharray:uae_city];          }else{             data1=[[nsarray alloc]initwitharray:oman_city];         }      }else  if (tableview == table2){         [self.but2 settitle:[nsstring stringwithformat:@"%@",selectedcell.textlabel.text] forstate:uicontrolstatenormal];     }else if (tableview == table3){         [self.but3 settitle:[nsstring stringwithformat:@"%@",selectedcell.textlabel.text] forstate:uicontrolstatenormal];      }else if (tableview == table4){         [self.but4 settitle:[nsstring stringwithformat:@"%@",selectedcell.textlabel.text] forstate:uicontrolstatenormal];     }     else if (tableview == table5){         [self.but5 settitle:[nsstring stringwithformat:@"%@",selectedcell.textlabel.text] forstate:uicontrolstatenormal];     }      else if(tableview == table6){         [self.but5 settitle:[nsstring stringwithformat:@"%@",selectedcell.textlabel.text] forstate:uicontrolstatenormal];         if ([selectedcell.textlabel.text isequaltostring:@"house"]) {             data5=[[nsarray alloc]initwitharray:home_op];         }else if ([selectedcell.textlabel.text isequaltostring:@"plot"]){             data5=[[nsarray alloc]initwitharray:plot_op];          }else if ([selectedcell.textlabel.text isequaltostring:@"commercial"]){            // data5=[[nsarray alloc]initwitharray:commercial_op];         }      }      table1.hidden=yes;     table2.hidden=yes;     table3.hidden=yes;     table4.hidden=yes;     table5.hidden=yes;     table6.hidden=yes;  } 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -