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).
Related
I have an idea for an iPhone game that basically involves interacting with a grid of squares (think letterpress)
What would be the easiest way to create a grid of coloured squares that can be interacted with by touch?
UIKit, Cocos2d or some other means like OpenGL? I understand the benefits of UIKit would be that I would be able to get touch events for each box (if I made them an object/container etc) but may not be as fast as cocos2d and I probably have far less control.
If you want to stick with UIKit, a random "Grid Component" framework could do the job for you. For example there's GMGridView, which has touch handling and everything you probably need out of the box already. (Just check out the example project provided with GMGridView)
I am developing a game for iPhone and I came across a question whether this can be done using UIAnimation or I have to switch to OpenGL.
If you see the picture above, you can realize there is a rectangle (it will have background image) having many holes in it. User is supposed to touch on holes and initiate the animation. The holes are actually on the image and are not some view. Do you know any article or tutorial I need to read in order to understand this can be done using UIAnimation?
It's more like chess. When you tap a hole, there is a view placed and moved at z-axis and then when you press the other hole, the view is moved to that hole and so on.
I believe it can be done with UIViews too. The holes can be made by using an image with "transparent" holes in it. You can place this UIView on top of a background image(if required). When touches are detected, you can animate another view on top of this view using addSubview:. You can keep this other view outside the screen bounds initially so that the animation seems like a sliding animation.
yes UIView is also an option in your case. if you feel that you will use high quality lots of graphic and will do lots of animation stuff at once on the screen, openGL will be the best or perhaps the gane you are making is a 2d game so you must consider COCOS2D "http://www.cocos2d-iphone.org/" for kick starting your game you'll surely get many effects and other glittering stuff with it. and bes of all it is openGL based..!! Performance will be too high for you..!!
Best of luck..!!
I am trying to build an app that detects if a user puts their lips on the screen. How could I get an image of their lips when they put it on the screen?
I know how to detect finger touches, would it be similar to that?
Edit: Also, wondering about doing this for Android.
I believe the iphone hardware supports somewhere between 10 and 20 touch points, but the SDK only gives you access to 5. To get a good outline of the lips you'd need a much higher number of touch points.
Could you use the front facing camera and avoid the obvious hygiene issues?!
You can't get the form of the touches, so you wouldn't be able to detect lips on the screens.
As others have posted here, it is not possible to detect all of the contact points of the lips and the screen. Yes, it would be similar, but more difficult. The iPhone screen is capacitive, so it should detect lips, which are similar to fingertips. (When outside in the cold and I need to scroll with my gloves on, I've used my chin.)
As far as the shape, you may be able to map multiple touches, but touches don't take on any particular shape, so you won't be able to draw the lips based on that. You may want to consider preloading generic pictures of lips and then resizing it to match the size of their lips, depending on where the touch inputs are.
i am quit new at iphone development and trying to make a photo collage software while learning it. Right now i have a lil problem and hope you can help me out.
I have an UiviewController with a view in it, in this view i have 7 scrollviews with uiimagevies in them for zooming and scollign images within these scrollviews.
All that works well but now i want to make these 7 scrollviews dragable and maybe if possible zoomable (so that the image within the given scroolview zoom together with the scrollview).
It should be possible to drag them all around the screen and if possible even overlap them
and by the way rotating would be great ;-) hope that is not to much asked for.
Would be great if someone can help me out with this..
Well you've got to decide on some other choice here because the functionality you are asking for overlaps, and you can't ask the app to magically know which the user wants to do. What I mean by this is that when you touch and drag within a scroll view, it's going to try to scroll itself, rather than drag the entire scroll view around.
As for rotation and zooming - that gets more complicated, because you start dealing with vector math and the like. You can check out my question on rotation here. The link I gave you has the code to get both rotation and zooming to work.
Please pardon my lack of Photoshop skills, but I'm curious what type of strategy Apps like Facebook and AP Mobile News are using for the 'label slider' in their applications. Here's a quick snippet outlining what I'm talking about as I'm sure the name I'm labeling the utility as is being butchered: http://dl-client.getdropbox.com/u/57676/slider.jpg
Essentially the user can touch the label and glide it along the X axis. It has a smooth bounce effect also once it hits the edges. This gives quite a bit more real estate if you need to present more on the screen than what your portrait mode allows for and is thus very valuable.
Is it a matter of just creating a UILabel that's wider than the screen with a bit of Touch API + Core Animation? Would love insight on how to start tackling this thing.
You'll most likely want to use a UIScrollView, with a UILabel as its content view. Size the label appropriately to your content, and then set the contentSize property of the scrollview to that size.
I created a similar control, and it's much easier than you think. It's just a UIScrollView with a series of UIButtons added to it. You could use labels instead of buttons - just depends on the feel you want. I think Facebook is probably using labels for theirs.
In any case, you'll probably want to use a series of components rather than one component (which is what Ben suggested) in the event that you want to, say, style the "selected" label differently from the others. It also makes hit detection a little easier.
You get the bounce effect for free by default - you may have noticed that most scroll views in iPhone apps do the same thing. It can be turned off as well.