ios - Use UILabel in Class Method -
so have this:
@interface viewcontroller : uiviewcontroller{ iboutlet uilabel *screen; } +(void)num:(int)number;
and want access screen in class in num method so:
+(void)num:(int)number{ screen.text = @"test"; }
but xcode says
"instance variable 'screen' accesses in class method"
is there way this?
yes, reason not letting because + sign in method denotes class method aka called on viewcontroller class don't have reference specific screen outlet.
change + - , able call method like
[self num:7]
and access screen outlet in method
hope helps!
Comments
Post a Comment