I create a UITableViewController's subclass:
class BaseTableViewController: UITableViewController {
var negozio : negozioAttivo?
}
Then , I created a BaseTableViewController's subclass
class offerteTableViewController: BaseTableViewController{
private var offerte : Array<offerta>?
private var cellIdentificatior : String = "Cell"
override func viewDidLoad() {
super.viewDidLoad()
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return (self.offerte)!.count
}
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return CGFloat(220)
}
override func viewWillAppear(animated: Bool) {
self.offerte = Database.getOfferteNegozio(1)
}
override var description: String {
return "Offerte"
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier(self.cellIdentificatior) as? TableCellSex
if (cell == nil ) {
var shop : negozioAttivo = self.negozio!
var id : Int = shop.id
var fotoPrinci : foto = shop.getPhoto(1)
var image : UIImage = fotoPrinci.downloadImage()!
cell = TableCellSex(text: shop.nome, image: image, id: self.cellIdentificatior, style: UITableViewCellStyle.Default,width: 150, height: 250 , star: Int(3) , distanza : "1km" , showHeart: true , male: shop.uomo == false , female: shop.donna == false)
}
return cell!
}
}
Then I created a UITableView
in StoryBoard and I give it the type of offerteTableViewController
, but when I execute it I get this:
the first cell is too above and goes off the screen ( in fact the picture is not seen completely)