//class1
competitionSettingsViewController.m
int *myint;
// in some void I made.
myint = 7;
//class2
competitionViewcontroller.m
#import "competitionSettingsViewController.m"
int *myextraint = 0;
competitionSettingsViewController a = [[competitionSettingsViewController alloc]........]
myextraint = a.myint;
答案 0 :(得分:1)
您可以使用property,如下所示:
@interface MyObject : NSObject
@property int myInt;
@end
然后您可以按如下方式访问它:
MyObject mo = [[MyObject alloc] init];
int myExtraInt = mo.myInt;
int myAltExtraInt = [mo myInt];