ios - Assigning variable with return value -
i new ios, if @ following code, expect both x , y "hello"
- (void)viewdidload { [super viewdidload]; nsstring *x,*y; y= [x getstring]; }//viewdidload -(nsstring *)getstring{ return @"hello"; }
yet, error: no visible @interface nsstring declares selector 'getstring'
i tried many things, defined getstring in .h file
your x variable type on nsstring ant there no method getstring defined there.
i believe want call [self getstring]
instead:
y = [self getstring];
Comments
Post a Comment