Reputation: 1133
I am trying to follow this video's guide on creating my own custom tableView cells
https://www.youtube.com/watch?v=EVJiprvRLoo
however, when I am doing the cell.photo.image part, Xcode tells me that UITableViewCell has no member 'photo'
Did i forgot to connect something to somewhere??
Thanks for the help guys!
Upvotes: 1
Views: 107
Reputation: 271
your problem will be solved.youtube video guide is correct but watch it carefully till end. try this code below. photo properties of uiimageview not uiview.
class CustomCell: UITableViewCell {
@IBOutlet weak var photo: UIImageView!
@IBOutlet weak var name: UILabel!
@IBOutlet weak var breed: UILabel!
}
// Next class
class Dog: UIViewController,UITableViewDelegate,UITableViewDataSource {
func tableView(tableView: UITableView,numberOfRowsInSection section: Int) -> Int {
return Names.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! CustomCell
cell.photo.image = images[indexPath.row]
Upvotes: 1