2015-08-27 105 views
0

我有一个原型单元格,当我触及它时会改变高度;下面是我做到这一点:更改单元格高度但不包含其中的元素

class SquadreController: UITableViewController 
{ 
    var index: NSIndexPath = NSIndexPath() 

    override func viewDidLoad() 
    { 
     super.viewDidLoad() 

     DataManager.sharedInstance.createCori() 
    } 

    override func didReceiveMemoryWarning() 
    { 
     super.didReceiveMemoryWarning() 
    } 

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int 
    { 
     return 1 
    } 

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int 
    { 
     return DataManager.sharedInstance.arrayCori.count 
    } 

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell 
    { 
     let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! UITableViewCell 
     let squadra = DataManager.sharedInstance.arrayCori[indexPath.row] 

     cell.backgroundColor = UIColor.clearColor() 

     return cell 
    } 

    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) 
    { 
     index = indexPath 
     tableView.beginUpdates() 
     tableView.endUpdates() 
    } 

    override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat 
    { 
     if index == indexPath 
     { 
      return 176 
     } else 
     { 
      return 88 
     } 
    } 
} 

好吧,它的工作完美。现在我需要把一个UIImage的该单元格,但我需要这种形象是这样的部分可见:

enter image description here

最终效果,我想知道这是相当类似这样mokeup https://dribbble.com/shots/1293959-LiveSport-App:喜欢mokeup在我的单元格中将放置UIImage,标签,视图,按钮。 这就是它,如果有人可以帮助我一步一步的指导做到这一点或一些教程,我将不胜感激!

回答

0

我简单地解决了设置顶部,左,右约束(不是底部)和UIImageView的高度约束;所以图像不会被调整大小,但部分被单元覆盖。

相关问题