How to display photos like iphone homescreen? - iphone

I'm trying to make an app that's displaying my photos from camera roll like app icons in iphone (matrix view) . The pictures will have the "wobble" effect and the pictures need to be rearrangeable(the posibility to swap pictures).
I found out how to implement the wobble efect.
What`s the best way to implement the displaying and swapping functionality?

I suggest you to show your photos using CALayer.
Add those layer in Matrix like pattern in your UIView using frame property of layer.
To move or rearrange photos find particular CALayer in touchesBegin method of View using touch points and Move it with movement in touched(in touchesMoved). Settle it in a proper location in touchesEnded method.
I have assumed that you have basic knowledge of usage of classes that I mentioned in above description.
Post here if you need more help.

Related

iPhone iOS how to create interactive drag, rotate, resize, delete view control?

I got an app that allows users to add content to a canvas. I would like to be able to offer the user an ability to move, rotate, resize, reflect this content. Currently I'm doing this with gestures, but would like to know if there is some sort of open-source widget that draws a box around the view and adds 4 buttons to do these functions:
rotate 90 degrees
rotate freely
resize
delete
Can anyone think of an open source framework that I can add to my project to create controls like the ones displayed?
I can probably build this by hand, but debugging gesture recognizers and view rotation is not the most fun thing, so I'm looking for something more polished.
Thank you!
Here's a link to an open source control on cocoa controls that looks like something you could use: TDResizerView.
"TDResizerView is used to resize and rotate an imageview with single finger"
Sounds like a good place to start from, even if you need to modify it.
I've never used this particular control though, so take my word for what it's worth.
edit: Also keep in mind that on iOS, users generally expect gestures. Forcing them to use the handles instead of pinching or rotating may be bad for your user experience, depending on why you want the handles instead.

UIImageView interactions

I am working on an app in which I want similar kind of functionality as that of WebMD body image.
How can I identify which part of image is touched in an optimal way? Do I have to slice the image according to requirements?
How can I add some tags into the image? Similar to the facebook photo upload functionality in iphone.
You need some way to figure out what the user touched, or tried to touch.
You might use a list of annotation-like objects, where each object has a location. When the user touches the image, you'll need to find the annotation in the list that's closest to the touch location and react appropriately. The "optimal" way to do that is probably to use a quad tree. For an iPhone app, though, the number of touchable points is probably pretty small (several dozen?), and a brute force search through the list will probably be more than fast enough.
Another option would be to overlay a transparent view on top of your image for each region that you want the user to be able to touch. Doing this would also make it simple to draw a "tag" at each of those locations.

How to implement pinch to zoom and flick with momentum for a drawing (graph) Core Graphics app?

In my app, I drew a graph using Core Graphics (inside a view, inside a view). Not a graphing calc app though, it graphs patient data and marks it every six months, and it is larger than the screen, so the user needs to have some way to move around. I was wondering if there is an easy way to implement pinch to zoom, or to flick with momentum. I was planning on just using UITouch to get notified when these actions were performed, but it doesnt really give you a lot of information. For example, all you get with the pinch to zoom is the ratio that they have zoomed, and all you get with the flick is the direction that they have flicked. So, I was just going to implement basic flicks without momentum, and simple pinch to zoom without being able to move around too.
But I figured I would ask here first, to see if anyone has a better idea about how to do this (easily).
EDIT: I found lots of places that tell you how to do this with photos, but none with core graphics or something like that, thanks.
I ended up using a UIScrollView, which implements pinch to zoom, and flick automatically (well, almost).

zooming in on image, showing more details

I am working on a little project and want to implement some sort of "google maps" zooming. What I mean with that is that I want to show an image, and let the user be able to zoom in into a bit of the picture.
The first image should show an overall view of an airport, with its terminals and gates ect. But when zooming in on a terminal it should show more details on where bus stops, taxi stops, info, café's ect are located. It should NOT be a map.
I have searched Google a bit, but couldn't really find anything. Anyone who has any suggestions? Preferable links to tutorials for similar things?
Best regards,
Paul Peelen
The standard way to implement this is by using a UIScrollView and within the UIScrollView add a custom UIView with CATiledLayer layers. You will render the image by drawing (setting content) to the inner CATiledLayer layers. Look at the PhotoScroller sample project.

Simulating graphing paper on iPhone

I need to implement 'graphing paper' in an iPhone app. The user should be presented with a grid. They user can touch individual squares to turn them on, or if they're already on, off.The user can pinch to zoom and scroll around the paper as well..
So far I'm thinking Quartz 2D + UIScrollView is the way to do this but these are both areas of iPhone development that I'm unfamiliar with. Does this seem like a reasonable strategy?
Yes, this would be the way to go. You could also create a UIView and give it a background color based off an image (+[UIColor colorWithPatternImage:]), but, myself, I'd go with option (a).