To make instance variables public, use the @public keyword, for example:
@interface PatientIDButton : UIButton { // we need 'class' level variables @public NSUInteger patientID; } @end
Of course, you need to keep in mind all the standard precautions when exposing "raw" variables for public access: you would be better off with properties because you would retain the flexibility to change their implementation at a later time.
Finally, you need to remember that accessing public variables requires dereferencing - either with an asterisk or with an operator -> :
PatientIDButton *btn = ... btn->patientID = 123; // dot '.' is not going to work here.
source share