クラスの 1 つに client という配列があり、その配列の情報を別のクラスで使用したいと考えています。プロパティを設定し、最初のクラスで配列を合成しました。私の最初のクラスのコードは
@synthesize client;
...
- (IBAction)testing:(id)sender {
NSString *textContent = myTextView.text;
textContent = [textContent stringByReplacingOccurrencesOfString:@" " withString:@""];
client = [textContent componentsSeparatedByString:@"."];
NSLog(@"%@", client);
}
2 番目のクラスでは、最初のクラスの h ファイルをインポートしてから、配列にアクセスしようとしました。私が使用しているコードは
- (IBAction)ButtonStuff:(id)sender {
ArrayManipulationViewController *myClass = [[ArrayManipulationViewController alloc]init];
NSLog(@"Second Interface");
NSArray *test = myClass.client;
NSLog(@"%@", test);
}