Scroll screen without using UIScrollView - iphone

I've seen iOS apps that allow users to scroll around a view that is larger than the screen itself, without seeming to implement a UIScrollView mechanic. So for example, the actual image displayed on the screen is double the width of the screen, and the user can pan left and right to view all the content. Is this just a case of making the ViewController's width twice that of the screen and allowing some kind of panning via gesture recognizers? With what I'm trying to do, it seems like this would be easier that implementing a UIScrollView...

Implementing scrollview is much easier than handling pan gesture, when Apple has given built-in functionality then why you do not want to use it?

You can either use UIPangestureRecognizer or UIscrollview. The Latter option is very simple.

Related

Handling touch events in uiscrollview

I have a UIScrollView and an UIImageView as its subview. I want to draw on the imageview in response to the single touches. And I want to zoom and pan the image view in the scroll view on pinch and pan gestures respectively. I found many solutions. But its not perfect. Please give me a straight forward solution.
use after subclassing UIScrollview.See the link.If you are doing application for iphone4 OS,try to use UIGestureRecogniser.see the sample code for it in Apple site.
If you are only using the scrollview for panning and zooming, I would suggest subclassing UIImageView to provide that functionality yourself along with the drawing. This will allow you to have finer control over it and quicker code. A scrollview is not very good at allowing complex gestures within it. (other than taps)

UIScrollView - A way to make one scroll view smaller than the other?

In my app, I have part of a view sticking out from the right. I would like the user to be able to swipe that to the left, to pull/reveal the rest of that view, which would basically almost cover the screen. See below:
I am figuring my best option is to use UIScrollView for two reasons. That I can lock the movement to horizontal only, and the animation for swiping is already built it.
My question is, can I have one page of the UIScrollView smaller than the other as shown in my mockup images?
UIScrollView horizontal paging like Mobile Safari tabs

Nesting UIScrollView inside UIScrollView Cocoa Touch

They "brush" the subject in this thread, but it does not really answer much:Stackoverflow UIScrollView question
I have a UIScrollView and a UIPageControl working together to present a set of views.
(Standard "Home screen" swipe style, in lack of better words)
Each of these views, inside the scrollView, has a thin menu in the bottom part, that can also be swiped from side to side. If anyone remember the previous FaceBook app, this also had a menu that could be swiped horizontally, however, not incased in another scrollView, but the idea is similar.
So the outer scrollView will scroll the entire view, including the view containing the inner scrollView, but the inner scrollView will only change a menu inside the view.
I already did a proof of concept test of this, what happens, is that delegate methods gets called in both the scrollViews no matter where on the screen the swipe takes place, and the innermost scrollView will crash the app when swiped left to right, but not right to left…
I sort of get the feeling that this can be done, but that Im going about it the wrong way.
Is there a way to set which area of the screen reacts to swipes? i.e. decide that the upper ¾ of the screen will call one set of delegate methods and the bottom ¼ will call another set.
Maybe through some sort of mediator that catches the swipes before they are "processed" and then determines which scrollView should react?
Hope someone can point me in a good direction on this one, thanks:)
What about de-nesting the scroll views? Instead of embedding a scrollview inside another scrollview, make them same-level siblings of a parent UIView.
In support of your nesting though, I can think of the App Store app which lets you scroll screen shots horizontally while the app description scrolls vertically.

How to zoom image in iPhone?

I need to zoom an image in iphone...while the user double clicks on the image it will be zoomed in and on the next click it will be zoomed out....Can anybody direct me to how to do this???
You would probably have to use the size property of UIImage, triggered by UIImageView's touchesBegan method.
You can also use animations if you want the zoom effect to be smooth.
Another option could be to place your UIImageView inside a UIScrollView, or use a UIWebView.
Also, I suggest you take a look at the Three20 project. I think TTPhotoView supports zooming.
If you want to zoom and scroll your view, you need a UIScrollView. Tricking it to do what you want used to be very hard, however the problem of programmatic zooming of UIScrollView is now solved.
I have a described how to do it, created ZoomScrollView class (a drop-in subclass of UIScrollView) to encapsulate the solution and provided a working example at github.com/andreyvit/ScrollingMadness/ (the README contains a long description of two UIScrollView tricks and the reasoning behind them).

iPhone SDK: disabling cllipping for UIScrollView

I'm working on an iPhone game, and trying to use a UIScrollView to display some icons, which I then want to enable the user to drag off the bar being scrolled, onto another view (basically, dragging them from their hand into play on the game board). The problem is that the UIScrollView clips everything outside it's own bounds.
Here is a picture of what I'm trying to do:
Functionally, it actually works, in that you can drag the icons up to the white board fine...but you can't see them as you are dragging...which is not acceptable.
Does anyone know if you can temporarily disable the clipping that a scroll view does, or is there some way to get around it? Hacky or not, I would really like to make it happen.
Does anyone have any other possible solutions for this? Or maybe any alternate approaches? I've considered if maybe a page view might work, but haven't tried it yet...and it's not at all as good of a solution as the scroll view.
Worst case I can just go back to not having the bar scrollable, but that really puts a damper on some of my game mechanics, and I'm really not too excited about that.
I think you're looking for the clipsToBounds property of UIView. I've used it successfully with UIScrollView:
scrollView.clipsToBounds = NO;
However, the dragging you want to do from the scroll view to the game view may require you to remove the icon view from the scroll view, place it in the superview at a position corresponding to its visible position within the scroll view (calculated using the scroll view's origin and content offset), and have that track the user's finger movements. On a release of the touch, either drop it on the game view at the proper position or return it to the scroll view.
I'm not 100% sure I understand the question but I think you should look into the z order of the scrollview and the whiteboard. It may be that the drag is just going behind the whiteboard.
Failing that, it would be useful to see all the bounds of your view heirarchy.
I also think a better solution allround might be to create a "sprite" to animate underneath the players finger - you could offset the drawpoint of the sprite from the touchlocation so that the player can see what they are dragging.