我有一个 ViewControllerA 和一个 ViewControllerB。我想从 ViewControllerB 调用 ViewControllerA 的方法。
在 ViewControllerA 中存在一个方法:
-(NSMutableArray*) loadData;
在 ViewControllerB.h 中:
#import "ViewControllerA.h"
.......
@property (nonatomic, strong) ViewControllerA * viewControllerA;
@property (nonatomic, strong) NSMutableArray * mutableArray;
在 ViewControllerB.m 中:
self.mutableArray =[viewControllerA loadData];
但该方法没有调用。为什么?提前致谢
你失踪了
self.
只要在viewController中的某个地方:
self.viewControllerA = [[viewControllerA alloc]init]; //or some other initialization occurs...
then:
self.mutableArray =[self.viewControllerA loadData];
将工作。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)