Reputation: 167
I have started to learn how to code for iOS in swift, in my app I am trying to use table view with custom cels, in the cells are four labels and two buttons, my problem is that buttons and two labels are not showing for some reason, I have checked some tutorials and searched stackoverflow but I couldn't find any answers for my problem.
this is how my storyboard looks:
this is my CustomCell class:
import UIKit
class CustomCell: UITableViewCell {
@IBOutlet weak var numberVehicle: UILabel!
@IBOutlet weak var nameVehicle: UILabel!
@IBOutlet weak var showHideButton: UIButton!
@IBOutlet weak var focusButton: UIButton!
@IBOutlet weak var hideLabel: UILabel!
@IBOutlet weak var focusLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
and this is code for my tableView function in controller:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("CustomCell", forIndexPath: indexPath) as CustomCell
let key = indexPath.row
let vehicle = vehicles[key]
let image = UIImage(named: "button.png") as UIImage?
cell.nameVehicle.text = vehicle.name
cell.numberVehicle.text = vehicle.number
cell.showHideButton.setBackgroundImage(image, forState: .Normal)
cell.focusButton.setBackgroundImage(image, forState: .Normal)
return cell
}
and this is how it looks in iOS simulator:
any help will be really appreciated
Upvotes: 0
Views: 55
Reputation: 558
Can you try this in storyboard bottom layout please.But first be sure
use Auto Layout
is ticked.
Upvotes: 3