unable to display urls in table @ masterViewController

36 views Asked by At

enter image description here

I'm not able to compile the code in masterViewController as

I'm receiving an error UITableView does not have member named textLabel

var urls = [NSURL(string: "http://trialwebsite.ucoz.com/GurujiHymns/02_BIGDI_MERI_TAQDIR_KO_Singer_Masoom_Thakur.mp3")!,NSURL(string: "http://trialwebsite.ucoz.com/GurujiHymns/02_BIGDI_MERI_TAQDIR_KO_Singer_Masoom_Thakur.mp3")!,NSURL(string: "http://trialwebsite.ucoz.com/GurujiHymns/03_GURU_JI_TERI_REHMAT_Singer_Sada_Thakur.mp3")!]

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell

    let object = objects[indexPath.row] as! NSDate
    cell.textLabe!.text = NSURL(string: urls)[indexPath.row] // error UITableView does not have member named textLabel
    return cell
}
2

There are 2 answers

7
Ashish Kakkad On BEST ANSWER

You are written

cell.textLabe!.text

you have to write

cell.textLabel!.text

To print url string in textLabel

cell.textLabel!.text = urls[indexPath.row].absoluteString!
0
Memon Irshad On

Try this

var urls = [NSURL(string: "http://trialwebsite.ucoz.com/GurujiHymns/02_BIGDI_MERI_TAQDIR_KO_Singer_Masoom_Thakur.mp3")!,NSURL(string: "http://trialwebsite.ucoz.com/GurujiHymns/02_BIGDI_MERI_TAQDIR_KO_Singer_Masoom_Thakur.mp3")!,NSURL(string: "http://trialwebsite.ucoz.com/GurujiHymns/03_GURU_JI_TERI_REHMAT_Singer_Sada_Thakur.mp3")!]

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell

let object = objects[indexPath.row] as! NSDate
cell.textLabe!.text = urls[indexPath.row]
return cell
}