わかりました、コアデータ用に作成したクラスがあります
LoginPass.h
それから私はファーストクラスを持っています
FirstClass.h
次に、SecondClass でこのクラスを使用する必要があり、@class で宣言します。ヘッダファイル
SecondClass.h
...
@class FirstClass;
@class LoginPass;
...
@interface SecondClass : UIViewController
{
......
}
@property (strong, nonatomic) FirstClass *fromFirstClass;
@property (strong, nonatomic) LoginPass *myEntity;
...
@end
そして.mファイルで
#import "SecondClass.h"
#import "FirstClass.h"
#import "LoginPass.h"
@implementation SecondClass
...
@synthesize fromFirstClass = _fromFirstClass;
@synthesize myEntity = _myEntity;
...
わかりました、コードでいくつかの間違いを犯す可能性があります。なぜ私が書く必要があるのか 本当にわからないし、今は面白くない
@synthesize myEntity = _myEntity;
だがしかし
@synthesize myEntity;
しかし、別の質問があります。コードで then を使用できる理由
self.fromFirstClass
でも使えない
self.myEntity
Xcode でエラーが表示され、使用する必要があると言われます
self._myEntity
違いは何ですか?self.fromFirstClass を使用できるのに、self.myEntity を使用できないのはなぜですか? @終わり