저는 xcode로 개발하는 것을 처음 접했고 다른 객체 안에있는 객체의 필드에 접근하는 방법을 궁금합니다 (예 : Vehicle Object 내의 Car 객체).Objective-C : 객체 내의 객체 필드에 접근하기
내 cellForRowAtIndexPath 메서드에 대해 내 Admission 클래스 내에있는 Patient Class 내의 필드에 액세스하려고합니다. 입학 객체를 보유하고있는 배열 [myList]을 가지고 있으며 입학 객체 내에 환자 객체가 있습니다. 여기
내 cellForRowAtIndexPath 방법에서, 나는 문제가 있습니다 코드입니다 :static NSString *CellIdentifier = @"SimpleCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
cell.textLabel.text = [[admList objectAtIndex:row]admPatName];
return cell;
}
문제는 다음이 줄에 다음에
cell.textLabel.text = [[myList objectAtIndex:row]??];
? 지역, 나는 분야에 대한 올바른 참조를 파악할 수 없었다.
제안 사항?
감사 JR 이와 같이
게시 하시겠습니까? .h 파일의 Patient 클래스? – dasblinkenlight
objective-C 오브젝트는 다른 오브젝트에 속한 필드에 직접 액세스 할 수 없습니다. (public C++ 멤버 에서처럼). 대신 다른 [otherObj getFoo] 또는 otherObj.foo 속성으로 메시지를 보내야합니다. – seand