So I made a test project in Xcode to see how I can use a UITextField
and UILabel
s, which are subviews of a UIView
. And the UIView
is a subview of a UIScrollView
. So after adding the views and the code in viewDidAppear
and when I scroll down the UIView
moves out of place.
Here is a video of the problem: https://drive.google.com/file/d/0B5j_BdtRjSyARWp3cGQ1dkMzMFk/view?usp=sharing
Please tell me what I am doing wrong.
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
scrollView.contentSize.height = 1000
scrollView.contentSize.width = view.frame.width
scrollView.showsHorizontalScrollIndicator = false
scrollView.showsVerticalScrollIndicator = false
scrollView.contentOffset.x = -8
scrollView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.25)
scrollViewChildView.backgroundColor = UIColor.blueColor().colorWithAlphaComponent(0.25)
}