import
UIKit
class
ViewController
:
UIViewController
,
UIScrollViewDelegate
{
var
scrollView:
UIScrollView
!
override
func
viewDidLoad() {
super
.viewDidLoad()
scrollView=
UIScrollView
()
scrollView.delegate =
self
scrollView.frame=
self
.view.bounds
var
imageView=
UIImageView
(image:
UIImage
(named:
"ii"
))
scrollView.contentSize=imageView.bounds.size;
scrollView.addSubview(imageView);
self
.view.addSubview(scrollView)
}
func
scrollViewDidScroll(scrollView:
UIScrollView
) {
println
(
"x:\(scrollView.contentOffset.x) y:\(scrollView.contentOffset.y)"
)
}
override
func
didReceiveMemoryWarning() {
super
.didReceiveMemoryWarning()
}
}
请发表评论