Sunday, 15 May 2011

ios - Can't call method from second ViewController -



ios - Can't call method from second ViewController -

i having problems getting application build. trying phone call method viewcontroller1 in current viewcontroller2.

in .h file of viewcontroller1 have declared method visible.

-(void)savelocation;

in viewcontroller2.h file have following

#import "viewcontroller1.h" @interface viewcontroller2 : uiviewcontroller @property (nonatomic,assign) viewcontroller1 *methodsave; @end

and in viewcontroller2.m

[self.methodsave savelocation];

it doesn't work , i've tried prepare while now. help great. give thanks you

i think have declared property @property (nonatomic,assign) viewcontroller1 *methodsave; have not allocated property. first allocate phone call function.

methodsave = [viewcontroller1 new]; [self.methodsave savelocation];

also declare property strong not assign @property (nonatomic,strong) viewcontroller1 *methodsave; should work.

and seek declare variable camel case.

ios objective-c iphone xcode ipad

No comments:

Post a Comment