나는 내 클래스 중 하나에 client라는 배열을 가지고 있는데, 그 배열에있는 정보를 다른 클래스에 사용하고 싶습니다. 속성을 설정하고 첫 번째 클래스에서 배열을 합성했습니다. 내 첫 번째 클래스의 코드는 내가 처음으로 클래스에 대한 시간의 파일을 가져 오기 한 후 바로 배열에 접근 시도 내 두 번째 클래스에서다른 클래스의 배열에 액세스하기
@synthesize client;
...
- (IBAction)testing:(id)sender {
NSString *textContent = myTextView.text;
textContent = [textContent stringByReplacingOccurrencesOfString:@" " withString:@""];
client = [textContent componentsSeparatedByString:@"."];
NSLog(@"%@", client);
}
입니다. 내가 사용하고 코드는
- (IBAction)ButtonStuff:(id)sender {
ArrayManipulationViewController *myClass = [[ArrayManipulationViewController alloc]init];
NSLog(@"Second Interface");
NSArray *test = myClass.client;
NSLog(@"%@", test);
}
'alloc'이 새로운 객체를 생성한다고 생각하면 어렵습니다. 즉, 이전에 가지고 있던 것과 완전히 다른 것입니다. 당신이 이전에 저장 한 것에 관한 것. –