Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 3, 2008, 08:31 PM   #1
gryym
macrumors newbie
 
Join Date: Jul 2008
Pinching and zooming in

Hey guys, do you know what documentation or website that i could refer to if i want to do some pinching? I was thinking like pinching on a tile and then it zooms in much like when you hold "Control + double finger scroll" on the Macs. And yeah, it can zoom out too to its original position.

Thanks.
gryym is offline   0 Reply With Quote
Old Aug 4, 2008, 08:26 PM   #2
gryym
Thread Starter
macrumors newbie
 
Join Date: Jul 2008
Pseudo Code

So here i planned out a pseudo code as a foundation to what i am gonna do in regards to the pinching.

(void)touchesMovedNSSet *)touches withEventUIEvent *)event
Place finger on phone
Detect if touches on phone == 2
- If (touch<2)
Nothing happen.
else if (touch == 2)
Detect whether its moving away from each other.
if (moving away)
call a "CGAffineTransformScale" (correct me if i'm
wrong) onto the image to zoom in.
else
zoom out of the image until the image gets scaled back
to its original position

It's a rough idea of what's going through my head, but i think i'm getting it somehow right. If anyone can shed some light onto this matter, its greatly appreciated.

Thanks in advance.
gryym is offline   0 Reply With Quote
Old Aug 5, 2008, 04:57 AM   #3
Taum
macrumors member
 
Join Date: Jul 2008
Hi,

If you're looking for Maps-like or Photos-like behavior, check out UIScrollView : it will do all the zooming/panning work for you.

If you need a more custom behavior though, I think you're on the right tracks. You want to keep track of the UITouch and check the euclidean distance between two touches to see if it grows up or down. Then you'll update the layer's transform property accordingly (scale.x & scale.y probably). You can read more info about layers/transforms in the Core Animation Programming Guide
Taum is offline   0 Reply With Quote
Old Aug 5, 2008, 08:17 PM   #4
gryym
Thread Starter
macrumors newbie
 
Join Date: Jul 2008
Thanks for the reply.

It looks like what i am trying to accomplish is similar to the photos-like behaviour. I'm currently checking out UIScrollView now and i think it works somewhere on a level which I expected it to. Now, the image looks itself to be scaled or enlarged.

Now, i'm trying to set the UIScrollView to "attach" itself to the view instead of the image. Will get back if its a success =)
gryym is offline   0 Reply With Quote
Old Aug 6, 2008, 12:16 AM   #5
gryym
Thread Starter
macrumors newbie
 
Join Date: Jul 2008
Managed to have the view scaled entirely instead of the image being enlarged. Found out that the cause was in the function:

Code:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
	return self.view;
}
Initially, it was returning the image that i had placed instead. So now it works. However, a few problems or modifications i want to make and i do not know yet how to:

**(1)Zoom into point of pinching instead of a default spot that its zooming into, which now is the top left corner of the scrollview.**

(2)Move the view around until the boundaries when the scrollview's scaled.

**(3)When the orientation is changed to landscape, the scrollview is not updated to that landscape view and still thinks it is in portrait mode.**

Thanks for the help

Note: (1) and (3) is "solved". Poses no orientation problems now. A guy just gave me a statement that the pinching in the IPhone simulator will not work according to your boundary according for the pinching. So that may be the reason that it's always like zooming to a corner of the screen size.Not sure about this, though...
(2) still eludes my understanding...

Last edited by gryym; Aug 8, 2008 at 02:43 AM.
gryym is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
General: Safari always allow zooming in jjk454ss Jailbreaks and iOS Hacks 0 Apr 4, 2014 12:06 PM
General: One finger zooming Qaanol Jailbreaks and iOS Hacks 6 Oct 8, 2013 03:45 PM
Maps: Zooming Krazy Bill OS X Mavericks (10.9) 0 Jun 12, 2013 11:32 AM
Involuntary Zooming suumessage Mac Applications and Mac App Store 4 May 14, 2013 11:51 AM
Zooming one application only? cameronjpu OS X 10.8 Mountain Lion 0 Oct 24, 2012 05:21 PM

Forum Jump

All times are GMT -5. The time now is 04:38 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC