I have a UIScrollView
inside another UIScrollView
. For example:
This grey area is my device. Red scrollview is in the background Yellow scrollview is a subview in red scrollview.
What i want to do is scroll up and down and still have an option to scroll right/left. But when i set delegate to yellow scroll view i cant move right/left. How to handle this ?
It is very easy, you just have to check which scrollView you are using to call the delegate method.
In your delegate method:(your delegate method receives a parameter UIScrollView *)scrollView
if(scrollView == scrollView1) {
//do stuff for scrollView1 like setContentSize
} else {
//do other stuff
}
This is how you control 2 scrollViews with one delegate method.
About what you want to do:
It more be more useful to only make 1 scrollView and set its properties so you scroll to left and right and up and down, two scrollviews are useless and the fact, that they overlay is a problem because the scrollview underneath can not be accessed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.