Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

cjlesh

macrumors newbie
Original poster
Jan 6, 2009
5
0
I'm just getting started with iphone programming, and so far it has been fun, although I must admit that Python has spoiled me for other languages.

Anyway, I've worked through the new Apress book and some of the official tutorials, so I have a basic grasp of what the phone is capable of and I'm starting to get the hang of objective-c.

Things have definitely not 'clicked' for me yet, but today I had an epiphany about delegates, so I'm on my way.

Now to my question. I would like to create a simple 'alphabet' app for my three year old daughter to play with. I know there are plenty on the app store, but I'm not writing this to sell, just to learn.

So I'd like to create 26 PNGs, 320 x 480, each containing small picture and letter (ie. the letter 'A' and a picture of an Apple). I'd like two user interactions, swipe left or right to go to the previous or next letter, and tap to hear the letter pronounced.

I can't quite wrap my head around how to do it. My guess is a single view app, then programmatically animate the sliding screens with Core Animation. The effect I'm looking to create is identical to the interface is the Photos app.

I can handle detecting swipes and taps, and I know how to play sounds, I'm just stumped on moving the pictures around.

Can anyone give me some pointers in the right direction.?

Thanks in advance,
cjlesh
 

drivefast

macrumors regular
Mar 13, 2008
128
0
take a look at the "Scrolling" sample app from the sdk site, it demonstrates the use of the UIScrollView control. it may be exactly what you need - both for learning from it, and for accomplishing what you are trying to do. good luck.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Look at the MoveMe example for how to move a view. Animate its center. If you decide a swipe occurred move the view offscreen in the direction it was swiped and move the new view onscreen from the opposite side.

Consider doing this with previous/next buttons. Just have a stationary UIImageView and change the image when the buttons are tapped. Leave the swiping for v2.0
 

cjlesh

macrumors newbie
Original poster
Jan 6, 2009
5
0
Thank you both for the additional information, it was very helpful. Either solution should work for me.

Looks like I should really take the time to go through all of the sample code Apple supplies.
 

jtbullet

macrumors member
Jan 19, 2009
30
0
I want to do a sequence of 480x320 images (a comic book), that you swipe back and forth between. Thats all my app needs to do! Any insight you can give me I would appreciate. I am pretty new, and just hoping I can slice up a code sample to do it. I am an artist, and I dont really want to become too much of a programmer!
thanks for your time!
 

mpatric

macrumors newbie
Oct 20, 2008
21
0
cjlesh - there are many ways to skin a cat; however if I was writing the app, I would aim for the simplest thing that works, which is probably:

I would NOT have a view per letter (i.e. 26 views) - not sure if that's what you were proposing. It would be quite easy to have two views that you animate between (slide left-right or right-left). Each view can simply be an UIImageView (or custom subclass thereof). Then, all you would need to do is update the image of the non-visible UIImageView to be the appropriate letter image (not on my Mac right now, so haven't checked, I think the function is simply setImage), before animating the transition to it.

The view that is not showing can be 'behind' the other view, or hidden. Probably won't make too much difference.

You could load all the images up front, or load them when you need them.

]\/)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.