ios - SideMenuBar dont load -


i have sidebar menu made tableview. when user click on 1 cell sidebar, shows tableview categories (check image below). problem i'm facing click on cell sidebar , loads right viewcontroller, if click again not load, knows column same one, nothing.

i think problem in sidebar not load content because knows same indexpath. no? thank you

screen:

enter image description here

my sidebar code:

import uikit import parse  var opcoessidemenu: [string] =     ["inicio","perfil","restaurantes","categorias","meu restaurante","sair"]  class mymenutableviewcontroller: uitableviewcontroller { var selectedmenuitem : int = 0 override func viewdidload() {     super.viewdidload()      // customize apperance of table view     tableview.contentinset = uiedgeinsetsmake(64.0, 0, 0, 0) //     tableview.separatorstyle = .none     tableview.backgroundcolor = uicolor.clearcolor()     tableview.scrollstotop = false      // preserve selection between presentations     self.clearsselectiononviewwillappear = false      tableview.selectrowatindexpath(nsindexpath(forrow: selectedmenuitem, insection: 0), animated: false, scrollposition: .middle) }  override func didreceivememorywarning() {     super.didreceivememorywarning()     // dispose of resources can recreated. }  // mark: - table view data source  override func numberofsectionsintableview(tableview: uitableview) -> int {     // return number of sections.     return 1 }  override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int {     // return number of rows in section.     return opcoessidemenu.count }  override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {       var cell = tableview.dequeuereusablecellwithidentifier("cellmenu") as? uitableviewcell      if (cell == nil) {         cell = uitableviewcell(style: uitableviewcellstyle.default, reuseidentifier: "cellmenu")         cell!.backgroundcolor = uicolor.clearcolor()         cell!.textlabel?.textcolor = uicolor.whitecolor()         let selectedbackgroundview = uiview(frame: cgrectmake(0, 0, cell!.frame.size.width, cell!.frame.size.height))         selectedbackgroundview.backgroundcolor = uicolor.graycolor().colorwithalphacomponent(0.2)         cell!.selectedbackgroundview = selectedbackgroundview     }   //   cell!.textlabel?.text = "viewcontroller #\(indexpath.row+1)"       cell!.textlabel?.text = opcoessidemenu[indexpath.row] string      if cell!.textlabel?.text == "meu restaurante" {          if localizacaoactualizada.temrestaurante == false {    //  cell!.textlabel?.textcolor = uicolorfromrgb(0x303e73)         }      }       //vai procurar uma imagem com o mesmo nome que o que esta no array opcoessidemenu e colocado ao lado texto     var imagename = uiimage(named: opcoessidemenu[indexpath.row])     cell!.imageview?.image = imagename        return cell! }  override func tableview(tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat {     return 50.0 }  override func tableview(tableview: uitableview, willselectrowatindexpath indexpath: nsindexpath) -> nsindexpath? {      if localizacaoactualizada.temrestaurante == false {     if indexpath.row == 4 {return nil}     }       return indexpath  }  override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) {      println("selected row: \(indexpath.row)")      if (indexpath.row == selectedmenuitem) {         return     }       selectedmenuitem = indexpath.row      //present new view controller     let mainstoryboard: uistoryboard = uistoryboard(name: "main",bundle: nil)     var destviewcontroller : uiviewcontroller     switch (indexpath.row) {     case 0:         destviewcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("listarrestaurantes") as! uiviewcontroller         break     case 1:         destviewcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("perfilutilizador")as! uiviewcontroller         break     case 2:         destviewcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("categorias")as! uiviewcontroller         break     case 3:         destviewcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("perfilrestaurante")as! uiviewcontroller          break     case 4:         pfuser.logout()         destviewcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("viewcontroller1") as! uiviewcontroller         break     default:         destviewcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("inicio") as! uiviewcontroller           break     }        sidemenucontroller()?.setcontentviewcontroller(destviewcontroller) } 

}


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -