Objective-C Pointers

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

  1. darthtong macrumors newbie

    Jul 9, 2008
    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


    Jun 9, 2004
    Rochester, NY
    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

    Jul 9, 2008
    Wow...didn't think of that!

    Thank you so much, something so simple!


Share This Page