Adding UIPinchGestureRecognizer on a UIScrollview's subview - objective-c

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.

Related

UIScrollView Failing to Scroll

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.

Scrollview with uiview on top

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.

Zooming UIView inside a ScrollView via Pinch gesture on a Point

Due to some requirements I'm zomming subview of UIScrollView with UIPinchGestureRecognizer and not using UIScrollView's default zooming. In selector of gesture I resize my subview with a factor and reset contentSize of UIScrollView. It's working perfectly. The problem is that when I resize the frame of subview then it's increased or decreased in one direction. I want it to zoomin/zoomout on touched point like in a UIScrollView or in Gallery of iOS. How can I achieve this?

UITableView Scroll when touch starts on subview

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.

UIScrollView auto scrolls to bottom during change to landscape orientation

I have a scrollview with 2 UITextViews (neither are editable). When a change to landscape orientation occurs, the scollview inexplicably scrolls to the bottom. This behaviour does not occur when rotating to portrait. I have tried setting the scrollEnabled property before rotation to NO, but to no avail. Any help would be appreciated please.
I eventually found that by setting the scrollview contentsize to 0 before rotation and restoring it during or after rotation prevents this unwanted auto scrolling