Objective-C Pointers

Discussion in 'iOS Programming' started by darthtong, Feb 15, 2011.

  1. darthtong macrumors newbie

    Joined:
    Jul 9, 2008
    #1
    Hi all,

    I have an NSInteger property of a custom class called 'estimatedTime', now, in my UITableView class I'm trying to pass this property as a pointer to a UITableViewCell. I can't seem to get it to work! I've tried the following:

    NSInteger *pointer = sharedManager.tempTask.&estimatedTime;
    NSInteger *pointer = &sharedManager.tempTask.estimatedTime;

    I get the errors: lvalue required as unary '&' operand
    and: expected identifier before '&' token

    Can you not pass a pointer to a property? Is the property not just it self pointing to the ivar in my custom class? I need it as a pointer type so I can edit the value when a UITextField is changed inside the UITableViewCell.

    Thanks and hope it makes sense!
     
  2. Littleodie914 macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #2
    In my experience, it's much easier to just pass in your tempTask to the UITableViewCell, and when the user makes changes in the UITextField, simply update the property on that object. Passing pointers to NSInteger types is going to cause more headache than it's worth!
     
  3. darthtong thread starter macrumors newbie

    Joined:
    Jul 9, 2008
    #3
    Wow...didn't think of that!

    Thank you so much, something so simple!

     

Share This Page