第一步,公开一个可变数组mutArrHeig,记录所有cell返回的高度, 和一个 UIView属性 scrView (用来做类似条纹)
第二步,为进来页面设置的第一个显示内容添加, 然后设置scrView的位置大小(0,0,1,mutArrHeig[0](自己将字符串转成float))。(注意,scrView是添加到tableview上的)
第三步(重要部分)
functableView(tableView:UITableView, didSelectRowAtIndexPath indexPath:NSIndexPath){ }在这个方法里面 通过点击某cell,获取该cell的坐标系(x 和 y)
方法:letpointXAndY = tableView.rectForRowAtIndexPath(indexPath)
//高度的获取
varheigh =CGFloat()
heigh =CGFloat(self.mutArrHeig[indexPath.row]as!NSNumber)
UIView.animateWithDuration(0.2, animations: {
//这里根据自己的要求布局,改变UIView的frame
self.subView1.frame=CGRectMake(pointXAndY.origin.x+50, pointXAndY.origin.y,1, heigh)
})
网友评论