iPhoneアプリケーションプロジェクトの.hファイルに2つの@interfaceを定義し、もう一方の@interfaceで定義されたNSMutableDataオブジェクトを使用したいと考えています。これは可能ですか/それをどうやって行うのですか?別の@interfaceで定義されたオブジェクトを使用する
ありがとうございます!
私のコードは次のようになります。 NSConnectionの別の代理人を追加する理由は、これが2番目の接続であるためです(最初の接続のコードは表示していません)。
@implementation SecondNSDownloadDelegate
@synthesize responseData;
@synthesize test;
- (void)connection:(NSURLConnection *)connection didReceiveResponse:
(NSURLResponse *)response {
NSLog(test) <-- gives null(), this is the problem.
[self.responseDataYears setLength:0];
}
@end
@implementation ViewController
@class ViewController;
@class AnotherViewController;
@synthesize responseDataYears;
@synthesize test;
- (void)getAvailableYears {
NSString *test = @"test";
secondNSConnecterDelegate = [[SecondNSDownloadDelegate alloc] init];
[[NSURLConnection alloc] initWithRequest:[NSURLRequest
requestWithURL:[NSURL URLWithString:@"data_url"]]
delegate:secondNSConnecterDelegate];
}
@end
を使用してデータにアクセス別のオブジェクトの値にアクセスします。ポインタを使用してそのオブジェクトを実際に参照する必要があります。 –
私はあなたがこれを読んでくださいと思うhttp://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/OOP_ObjC/Introduction/Introduction.html –