"Instance variable 'xxx' accessed in class method....why?
Posted
by
Michael Levy
on Stack Overflow
See other posts from Stack Overflow
or by Michael Levy
Published on 2012-11-04T22:59:01Z
Indexed on
2012/11/04
22:59 UTC
Read the original article
Hit count: 831
So please forgive me as I am very new to stackoverflow and to ios programming in general.
I am attempting to change the text of a button i have, replacing current text with a date string (dateStringForInput) I am passing in from another class. The button is called myTodayButton and is declared in my .h file for my class inputMilesViewController... @property (strong, nonatomic) IBOutlet UIButton *myTodayButton;
Below is the code from my .m.
+(void) changeButtonText:(NSString*) dateStringForInput{
NSLog(@"we got to changebuttontext");
[_myTodayButton setTitle:dateStringForInput forState:UIControlStateNormal];
}
I am getting the following error "Instance variable "_myTodayButton" accessed in class method.
I understand that this is written in a class method rather than an instance method but i cant figure out how to get this change to happen. the button which prompts this call to changeButtonText is in the other class which is creating dateStringForInput.
please help! thanks so much! be gentle with me....a bit overwhelmed . :-)
© Stack Overflow or respective owner