我想从不同的类中分配一个整数数据的值。所以我做了以下事情:
我想从 A 类中分配一个声明为 B 类属性的值:
在 Bh 文件中
@interface B : UIViewController {
int num;
}
@property(readwrite)int num ;
在 Bm 文件中
@synthesize num;
现在在 Ah 文件中
@property(nonatomic,strong)B *b;
然后在 Am 文件中
b=[[B alloc]init];
b.num=5;
问题是当我使用 NSLOG num 时
NSLog(@"The Number is %d",num);
在 B 类中它总是显示 0,我已经尝试过NSString
,它也传递了 NULL。我被困在这里,请任何人可以帮忙吗?