Noobie ARC Question

Discussion in 'iOS Programming' started by loon3y, Dec 1, 2011.

  1. loon3y, Dec 1, 2011
    Last edited: Dec 1, 2011

    loon3y macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #1
    so with ARC, basically i don't have to type in [whatever release]; after every pointer?


    just to make sure i understood it correctly



    edit: what about retain? because I've read that retain isn't necessary also, so what would be put in the header when u identify the method?


    for example, is it implying i don't need the retain? if not what would i put in place of it?


    Code:
    
    @interface FirstViewController : UIViewController
    {
         IBOutlet UILabel *onHand;
    }
    
    @property (nonatomic, retain) UILabel *onHand;
    
    @end
    
    
     
  2. jaikob macrumors 6502

    jaikob

    Joined:
    Jul 1, 2008
    Location:
    Freeland, MI
    #2
    You still keep retain, it's just the compiler that takes care of the rest. Otherwise the compiler wouldn't know to retain it, and when to release the memory.

    Your header files should remain largely untouched.
     
  3. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #3
    Are there any really clear tutorials/videos on how to use ARC that anyone would recommend?
     
  4. loon3y thread starter macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #4
    isn't it just not typing in release and such things like that?



    it seems like it does more from reading your question? what more does it do?


    edit: and what about strong? i heard its the replacement for retain in ARC apps, if i were to convert my app to ARC would i have to change my "retains" to "strong" ? because it worked perfectly fine with retain.
     
  5. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  6. loon3y thread starter macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #6
    no, i haven't thank you, i read it and i think its basically saying retain is replaced with strong and weak.



    im reluctant to look at documentation because i still can't read/understand it yet.

    but it does make more sense than it did 3 months ago lol. as I'm going through another iOS book, its more understandable, the first book i went through i didn't know what i was reading.

    grasping the whole concept and terminology seems pretty tedious.
     
  7. MattInOz macrumors 68030

    MattInOz

    Joined:
    Jan 19, 2006
    Location:
    Sydney
    #7
    All I can say is Don't delay reading the documentation. Even if you get to the end of part and only bits made sense, your still better off. At least then the ideas are in your mind and starting to gel. There is nothing to say you can only read it once. It helps to read it a many, many times. Different things will make sense in different contexts. Try cherry picking bits that seem interesting and the it'll lead you towards the next bit of interest.
     
  8. loon3y thread starter macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #8
    thanks, for the advice, yea I've been rushing chapters and such also in the beginning and it wasn't too great.

    i realized i have to spend a lot of time on each and practice and experiment to grasp everything. I'm just really impatient i just wished everything just made sense the first time and it gels in the first time around
     
  9. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #9
    Don't rush! It's not helping you and, therefore, it's not helping us (provide you help). Slow down; you'll be glad you did in the long run.
     

Share This Page