ios - Why is the second return statement being called and why am I getting the return error? -


i have 2 uitableviews not related each other @ all, on same view. animal tableview showing information, animallocation not displaying anything. put breakpoint on second return statement in second if statement, program not stop. getting error (look below). how fix this? first if statement works. animallocationarray populated prints ("africa", "india", "south america"). error http://puu.sh/mnk2j/549dde1225.png

func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {      if(tableview == animal){      var cell: animalcell = self.reviews.dequeuereusablecellwithidentifier("cell") as! animalcell     cell.box.text = animalarray[indexpath.row]     if(indexpath.row % 2 == 0){         cell.backgroundcolor = rgb("ffffff")       }else{         cell.backgroundcolor = rgb("f98233")      }       return cell      }     if(tableview == animallocation){         var cell: location = self.reviews.dequeuereusablecellwithidentifier("location") as! location         cell.label.text = animallocatioarray[indexpath.row]         if(indexpath.row == 0){             cell.label.textcolor = rgb("fffff")          }          if(indexpath.row != 0){             cellvs.vslabel.textcolor = rgb("f52654")          }           return cell //placed breakpoint here nothing happens      }  } 

you miss case default. can edit

if(tableview == animal){  var cell: animalcell = self.reviews.dequeuereusablecellwithidentifier("cell") as! animalcell cell.box.text = animalarray[indexpath.row] if(indexpath.row % 2 == 0){     cell.backgroundcolor = rgb("ffffff")   }else{     cell.backgroundcolor = rgb("f98233")  }   return cell  } if(tableview == animallocation){     var cell: location = self.reviews.dequeuereusablecellwithidentifier("location") as! location     cell.label.text = animallocatioarray[indexpath.row]     if(indexpath.row == 0){         cell.label.textcolor = rgb("fffff")      }      if(indexpath.row != 0){         cellvs.vslabel.textcolor = rgb("f52654")      }       return cell //placed breakpoint here nothing happens  } 

to:

if(tableview == animal){  var cell: animalcell = self.reviews.dequeuereusablecellwithidentifier("cell") as! animalcell cell.box.text = animalarray[indexpath.row] if(indexpath.row % 2 == 0){     cell.backgroundcolor = rgb("ffffff")   }else{     cell.backgroundcolor = rgb("f98233")  }   return cell  }  var cell: location = self.reviews.dequeuereusablecellwithidentifier("location") as! location  cell.label.text = animallocatioarray[indexpath.row]  if(indexpath.row == 0){      cell.label.textcolor = rgb("fffff")   }   if(indexpath.row != 0){     cellvs.vslabel.textcolor = rgb("f52654")   }    return cell //placed breakpoint here nothing happens  

Comments