我想创建一个子视图,弹出UITableView
,其中包含UIImageView
上cell
的全屏显示图片,右上角有一个退出按钮以及另一个UITextView
或cell
cell
的{{1}}
UITextView
有什么想法吗?谢谢!
答案 0 :(得分:3)
使用以下代码..
func imageTapped(gesture: UIGestureRecognizer) {
var overlay : UIView = UIView(frame: CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height))
var imageView : UIImageView = UIImageView(image: (gesture.view as! UIImageView).image) // This includes your image in table view cell
imageView.frame = CGRectMake(0, 0, 0, 0) // set up according to your requirements
var doneBtn : UIButton = UIButton(frame: CGRectMake(0, 0, 0, 0)) // set up according to your requirements
doneBtn.addTarget(self, action: "pressed:", forControlEvents: .TouchUpInside)
overlay.addSubview(imageView)
overlay.addSubview(doneBtn)
self.view.addSubview(overlay)
}
func pressed(sender: UIButton!) {
sender.superview?.removeFromSuperview()
}