开发者

how to use value of local variable in another method?

开发者 https://www.devze.com 2023-01-07 17:06 出处:网络
- (void)viewDidLoad { } -(id)initwithinfo2:(NSInteger)pass_wordID2 { NSLog(@\"pass_wordID:%d\",pass_wordID2);
- (void)viewDidLoad {


}

-(id)initwithinfo2:(NSInteger)pass_wordID2
{
    NSLog(@"pass_wordID:%d",pass_wordID2);


}

I want to use pass开发者_运维技巧_wordID2 in viewDidLoad. How ?


Make an Instance Varibale in the *.h file. Than do it like this in initWithInfo2:

yourInstanceVariable = pass_wordID2;

Than you can use yourInstanceVariable in viewDidLoad. ;-)

0

精彩评论

暂无评论...
验证码 换一张
取 消