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.
Related
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 have a tableview with different kind of cells, one of which has some UITextFields's and UIButton. When i try to scroll this view with the touch starting in any of those subviews the table won't scroll and recognizes it as a 'touch inside' of a subview. I had it before with "delays content touches' but the touch inside button doesn't work well. Any ideas how i might fix this problem?
I just found i had an 'UITapGestureRecognizer' that was creating the problem. thank you for the help
Turning off "Cancellable Content Touches" in the UITableView solved this for me (in the UITableView attributes inspector under Scroll View / Touch). I got this from this SO question: Scrolling a UITableView inside a UIScrollView
From the UIScrollView:canCancelContentTouches doc:
If the value of this property is NO, the scroll view does not scroll regardless of finger movement once the content view starts tracking.
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.
First off, how do you test scrolling in the iPad simulator? I have a touch pad and I've tried dragging two fingers and I've tried click & dragging two fingers, but I can't get it to scroll. Am I doing that part correctly?
Assuming that I'm testing properly, why won't my scrollview scroll? I have a basic view controller in my storyboard and I dragged a scrollview into it. I made an outlet from it into my code and then in my code I generate a bunch of buttons and add them to this scrollview. They get displayed properly. Am I missing something?
set scrollview content size such
[MyScrollView setContentSize:CGSizeMake(320, 500)];
this is for iPhone for example.
You can also make two fingers by press the alt key next to cmd in mac
HOLD PRESS alt + mouse move on simulator
set contentsize of the scrollview,to enable scroll.
Detailed explanation
https://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/UIScrollView_pg/CreatingBasicScrollViews/CreatingBasicScrollViews.html
You have to define the contentSize of scrollView which is generally bigger in frame than parentview or its frame to make it scrollable.
[viw setContentSize:CGRectMake(width,height)];
set it in viewDidLoad or where You alloc srollview.