ios - How to implement 2 UITableViews in 1 ViewController? The tableViews each have their own custom cell -


i have 2 tableviews each own custom cell. how can implement these tableviews in 1 viewcontroller? here code.

xcode can't cast custom cell standard uitableviewcell

func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int {     //        let accountsize = int(accounts.count())     //        return accountsize;      var count:int?      if tableview == self.tableview {         count = int(accounts.count())     }      if tableview == self.tableviewloan {         count =  int(loans.count())     }      return count! }  func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     //        return uitableviewcell()  var cell:uitableviewcell?         if tableview == self.tableview {         //cell = tableview.dequeuereusablecellwithidentifier("accountstableviewcell", forindexpath: indexpath) as! accountstableviewcell         var cell1 = tableview.dequeuereusablecellwithidentifier("accountstableviewcell", forindexpath: indexpath) as! accountstableviewcell          var account:suvtisdda = suvtisdda()         account = accounts.objectatindex(uint(indexpath.row))          var accounttype = ""         var accountnum = ""          let accountnumber = account.description.value         var accountsplit = accountnumber.componentsseparatedbystring(": ")         if(accountsplit.count > 1){             accountnum = accountsplit[1]             accounttype = accountsplit[0]             print("account number: \(accountsplit[1])")         } else {             accounttype = account.description.value             accountnum = " no account number"             print("account number unavailable")         }          let formatter = nsnumberformatter()         formatter.numberstyle = .decimalstyle          cell1.accounttypelabel!.text = accounttype         cell1.accountnumberlabel!.text = accountnum         cell1.accountcurrencylabel!.text = account.currency.value         cell1.accountamountlabel!.text = formatter.stringfromnumber(account.availablebalance.value)         cell1.accounttypelabel!.textcolor = uicolor(red:0, green:0.451, blue:0.682, alpha:1)          return cell1     }      if tableview == self.tableviewloan {         var cell2 = tableview.dequeuereusablecellwithidentifier("loancell", forindexpath: indexpath) as! loancell          var loan: suvtiln = suvtiln();         loan = loans.objectatindex(uint(indexpath.row));          cell2.descriptionlabel.text = loan.description.value;         cell2.currencylabel.text = loan.currency.value;         cell2.[![valuelabel][1]][1].text = loan.loanamount.value.stringvalue;          cell = cell2;     }     return cell; } 

http://i.stack.imgur.com/an6g2.png

i not sure trying do. maybe try using containerviewcontroller , embedding 2 tableviewcontrollers that. should give effect of having 2 tableviews in 1 viewcontroller have separate files each tableviewcontroller.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -