xcode - UITableViewCell variables ni? -


i have correctly setup tableview using nib. register nib , identifier. somehow, getting nil in code here:

func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     let cell = gallerytable.dequeuereusablecellwithidentifier("gallerycustomcell", forindexpath: indexpath) as! gallerycell 

it takes me custom cell created , telling me every variable nil. have reconnected outlets , still receive errors.

in custom cell, crashes here:

override func awakefromnib() {     super.awakefromnib()     // initialization code     self.backgroundcolor = uicolor.whitecolor()      var tapphotoaction = uitapgesturerecognizer(target: self, action: selector("phototap:"))     tapphotoaction.delegate = self     tapphotoaction.cancelstouchesinview = false     galleryphoto.addgesturerecognizer(tapphotoaction) 

any thoughts on why happen @ all? saying galleryphoto nil, should not be. have outlet connected. also, happens on simulator, not on real device.

edit:

i not using storyboard, xib. have following code not using registerclass.

gallerycellloader = uinib(nibname: "gallerycell", bundle: nil)  gallerytable.registernib(gallerycellloader, forcellreuseidentifier: "gallerycustomcell")  

try delete

self.tableview.registerclass(uitableviewcell.self, forcellreuseidentifier: "gallerycustomcell") 

then click tableview storyboard + ctrl , , drag line view controller , register table view. view controller should show

 @iboutlet weak var tableview: uitableview! 

( should use

class viewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource   

in view controller have table view, click tableview in storyboard + ctrl , drag view controller click delegate , datasource )

then try run code again.


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) -