I'm looking for days for a (work) tutorial or even an example app that uses UIScrollView Used to scroll vertically, programmically, that is, i.e. There are many tutorials to use on the storyboard, leave me on lose.
I looked through the documentation of the apple, and their "guide" is still not a concrete example or sign that is starting from where.
What I have tried so far, is doing some of the following.
Scroll directly to a scroll view in my view
scrollView = UIScrollView (frame: UIScreen.mainScreen (.) Border)
Then assign the scene to my view. Deedload function
self.view = scollView
Try changing the content size.
self.scrollView.contentSize = CGSize (width: 2000, height: 5678)
scrollView.scrollEnabled = True
and the last software I could find by doing this program
Override funk viewDidLouthSuivis () {Super.viewDidLayoutSubviews () scrollView.frame = view.bounds}
Currently I did not try to add my objects to the havn scrollview, (I need to zoom Do not have to be just vertical scrolling), but I have not been able to do anything :( In fact, running the app with those extra pairs causes UIPlum, the screen is taken up oddly , And it does not fit into the full width of my screen? I decided to make the frame width equal to width, but still did not work
I have not received any error.
I would like to see the controller to see an example. You can scroll vertically!
Edit the scenes with the screenshot of the disaster, while trying to make my view scrollable.
(Instead of image, due to the lack of points to insert the image directly.)
(I have made scrollview background red, see For that it is showing correctly, which seems like this. Still I can not scroll anywhere
As suggested in the suggestion, self.view = self.scrollview Instead of doing it, I try to add ScrollView instead of its viewview, but with a positive result. Edit
2: Adding
scrollView.contentSize = CGSize (width: 2000, height: 5678)
DidLayoutSubviews, as suggested in the comments below, my view was scrolled!
Although my layout still looks like a complete mess for some reason (It looks like I think before scrolling it).
Here's an example obstacle for my topbar (blue color), which is full horizontally CE would want to take the Spa.
self.scrollView.addConstraints (NSLut contract. Konstruckwikual format ("H: | [Top Bayer] | ", option: zero, matrix: zero, view: viewsDictionary))
Any idea why this does not work?
Then add all the labels, buttons, etc. to the ScrollView and then size the content.
Content size is a parameter that will tell scrollwall to scroll.
put Self.scrollView.contentSize = CGSize (width: 2000, height: 5678) < / Code> inside
viewDidLayoutSubviews
.
No comments:
Post a Comment