iPhone Dev Info?

Posted:
in iPhone edited January 2014
Where are a few good sites (other than at Apple) to learn iPhone app development, specifically I'm looking for resources for the UI and graphics end of things... Hopefully there are a few devs here willing to give some pointers. Thanks all.

Comments

  • Reply 1 of 4
    Quote:
    Originally Posted by SpamSandwich View Post


    Where are a few good sites (other than at Apple) to learn iPhone app development, specifically I'm looking for resources for the UI and graphics end of things... Hopefully there are a few devs here willing to give some pointers. Thanks all.



    To be honest I don't think you need any other website apart from the Apple site, and a few books. I've just released my first app programmed by myself. I hadn't done any coding for 15 years (I was a C programmer way back then), and within 5 weeks I'd learnt enough Objective-C and iPhone dev to put the app together. I'm not claiming to be a great iPhone developer, but I managed ok. All I used was...



    Apple primer docs (all the Required Reading docs in the developer reference library) - these are great reads, especially if you haven't done any OO & Cocoa dev before.



    K&R's The C Programming Language book - just to refresh on basic C stuff



    Beginning iPhone Dev book by Mark LaMarche - it won't get you developing whiz-bang apps but it certainly provides a great introduction to what you need to know.



    Beyond that, the class descriptions on the Apple site are great, and the blogosphere in general was used just to see how other people handle the same problems as you're facing.



    Good luck.



    Noel
  • Reply 2 of 4
    Quote:
    Originally Posted by noel_h View Post


    To be honest I don't think you need any other website apart from the Apple site, and a few books. I've just released my first app programmed by myself. I hadn't done any coding for 15 years (I was a C programmer way back then), and within 5 weeks I'd learnt enough Objective-C and iPhone dev to put the app together. I'm not claiming to be a great iPhone developer, but I managed ok. All I used was...



    Apple primer docs (all the Required Reading docs in the developer reference library) - these are great reads, especially if you haven't done any OO & Cocoa dev before.



    K&R's The C Programming Language book - just to refresh on basic C stuff



    Beginning iPhone Dev book by Mark LaMarche - it won't get you developing whiz-bang apps but it certainly provides a great introduction to what you need to know.



    Beyond that, the class descriptions on the Apple site are great, and the blogosphere in general was used just to see how other people handle the same problems as you're facing.



    Good luck.



    Noel



    Thanks for the help. Seems like there are fewer devs who visit here than I thought. Good luck with your app!
  • Reply 3 of 4
    amoryaamorya Posts: 1,103member
    I'm just not sure what to say really -- I already knew cocoa programming on the mac (Read the Hillegass book for that), so it was easy to pick up iPhone development. My first iPhone app was two weeks from start to finish (and is now awaiting review in the app store). Hence I can't really comment about how to learn iPhone development if you don't already know Cocoa.
  • Reply 4 of 4
    amoryaamorya Posts: 1,103member
    Trying to be a bit more specific: for UI, learn to love Interface Builder. You have to learn to work with it rather than fight it, but when you get it then it makes things a whole lot easier.



    iPhone apps tend to tie views to view controllers, whereas on Cocoa you might have one controller responsible for a number of views. To make the common hierarchical style of iPhone app (click on an item in a list and the screen slides sideways, with a back button top left) use UINavigationController. Once you get your head round that, you're set: the framework takes care of backtracking and all the animation for you.



    Graphics are mainly done through Core Graphics. Mac development tutorials that use it should work. There's a few differences in the names for the data structures (CGRect vs NSRect), but it's mostly the same. Be aware that iPhone views have their origin in top left, vs bottom left on the mac, so if you port things directly it'll end up flipped.



    For example, to draw a pair of white lines, crossed over around the centre of the view:



    Code:




    - (void)drawRectCGRect)rect

    {

    float axisColor[4] = {1.0, 1.0, 1.0, 1.0};



    CGContextRef ctx = UIGraphicsGetCurrentContext();





    /* white line */

    CGContextSetStrokeColor(ctx, axisColor);

    CGContextMoveToPoint(ctx, [self bounds].origin.x, [self bounds].size.height / 2.0);

    CGContextSetLineWidth(ctx, 1.0);

    CGContextAddLineToPoint(ctx, [self bounds].origin.x + [self bounds].size.width, [self bounds].size.height / 2.0);

    CGContextStrokePath(ctx);



    CGContextSetStrokeColor(ctx, axisColor);



    CGContextMoveToPoint(ctx, [self bounds].origin.x + [self bounds].size.width/2 + 0.5,

    [self yCoordinateForValue:1.1]);

    CGContextAddLineToPoint(ctx, [self bounds].origin.x + [self bounds].size.width/2 + 0.5,

    [self yCoordinateForValue:-1.1]);



    CGContextStrokePath(ctx);

    }









    Note that this is being done inside drawRect: just like on the mac. You can draw elsewhere, but it requires complicated stuff to get hold of the correct graphics context. Much better to put it all here.



    I'm not sure what level you want me to pitch this, so forgive me if you already know some cocoa and the following seems patronising, but here's how you use the above code:
    • Create a new subclass of UIView (choose New File within your xCode project). Add the above method into the new .m file you've created, just after the @implementation line.

    • In Interface Builder, drag in a Custom View into your app's window.

    • In the inspector, with your new view selected, set its class to the name of the class you just created.

Sign In or Register to comment.