Is it to possible insert a scrollview into another scrollview? I noticed that the contained scrollview is freezed and do not move when I scroll the main
The UIScrollView can be contained in another UIScrollView. If the contained scrollView's content size is not greater than the parent scrollView then it'll remain frozen.
You absolutely can, UIScrollView inherits from UIView and you can use it's addSubview method.
Related
In my application I want add a tableview inside a UIScrollView .When the scroll of UITableView reaches the bounce, it should scroll the outer scrollview. But its not happening for me, UITableView is scrolling smoothly.Once it reaches the bounds, it stops. I need the functionality similar to the attached gif .
Please provide some code & you UIScrollView must be smaller than the view.
I have a UIScrollView with a fair bit of content in it. The structure is shown below:
However, my scrollview isn't allowing a scroll to occur. I have made sure AutoLayout is off and the scrollview is larger than the screen size. The ScrollView isn't altered in the .h or .m files in any way. Any ideas why it may not be scrolling? The settings are default for the scrollview (essentially dragged and dropped in IB). ScrollView sizes as below
Your UIScrollView should be equal to or smaller than your screen. The content of your scroll view should be larger than your scroll view's frame. (It is the content of the scroll view that scrolls within the bounds of the scroll view's frame.)
Then, in code, do something like this:
[scrollView setContentSize:CGSizeMake(contentWidth, contentHeight)];
[scrollView setScrollEnabled:TRUE];
The scrollView should (typically) NOT be larger than your screen size.
It's NOT the scrollView that scrolls, it's the content IN the scrollView that scrolls.
So set the contentSize of your scrollView to the appropriate size of your content and keep the scrollView itself within the bounds of the screen.
I have scrollview and on top of it there is a uiview, what I want to do is when i scroll scrollview then top uiview should also get scrolled accordingly. I don't want to put that uiview inside the scrollview due to some reason . but how to make it scrollable even though it is not inside the scrollview.
If you want another view to scroll, it should also be a UIScrollView or a class which inherits it. The UIView itself is not scrollable.
Thus, you could link you background scroll view contentOffset to your front scroll view.
Anyways, your restrictions are strange. If you could be more explicit, someone might provide you a more usefull/simple method to achieve your tasks.
You can listen to the scrollView's contentOffset with KVO, and update your upper UIView's transform accordingly.
I'm adding a view as a UIScrollview's subview. This subview determines the contentsize of scrollview. On this view I add a UIPinchGesture and in selector target method of gesture i resize the view and reset contentsize of scrollview. BTW I earlier tried zooming of scrollview but it didn't fulfilled my requirement so I did it with UIPinchGesture. My problem is that normally the content size of scrollview is greater than it's frame so scrolling is enabled. When I try to pinch with two fingers the scrollview's scrolling is triggered and Pinchgesture seldomly recognized. I can't disable scrolling of UIScrollview as this is one of my requirement. Can anybody help me to solve this problem.
Set delayContentTouches property of UIScrollView to NO (instead of the default YES). This will allow the touch to propagate to the subviews of the scroll view immediately.
I am trying to imbed a scrollView in the detail side of a splitViewController. Should the scrollView be added inside the 'View', as displayed in the image below?
Or does the 'View' need to be removed, leaving a View Controller and a Scroll View only?
Also, when I add the scrollView to the page, the bottom is being cut off, preventing it from scrolling all the way to the bottom. I also tried resizing the scrollView in the ViewDidLoad method of the View Controller to something extremely large such as:
theScrollView.contentSize = CGSizeMake(20000, 20000);
That did not work either. It seems that we can hold down the mouse and pan, but the scroll bars are always the same length. Thanks your help!
I have ALWAYS implemented scrollviews as the UIScrollView with a UIView inside of it, then your other elements (i.e. buttons, text views, etc...) SO the hierarchy would be
UIScrollView
UIView
UILabel
UIButton
.
.
.
Because you dont really have a top UIView WITHIN the scrollview, this is most likely why your
theScrollView.contentSize = CGSizeMake(20000, 20000);
line is not working as intended.