이 프로그램은 간단히 말해서 기본적으로 다음과 같이이다 :UIView는 UIViewController의 속성에 액세스 할 수 있습니까?
================================== =
는 는 UIViewController에가 있고, 그것을 NSInteger의 인스턴스 변수를 갖는다:
I가 같이있는 UIViewController .H 파일 선언 : 다음
NSInterger *theNum;
...
@property NSInteger *theNum;
를, I는 해당하는 .m 파일에 합성 :
@synthesize theNum;
이 UIViewController의보기 (UIView)에는 doSomething : theNum 값에 액세스해야하는 메서드가 있습니다. ========================
-(void)doSomething {
NSInteger *myNum = self.superview.theNum; //error: request for member 'theNum' in something not a structure or union
// do something
}
: 여기
는하는 .m 파일의이 "보기"의 코드 ======그래서 UIViewController에서 theNum의 값을 UIView로 가져올 수 있습니까?
고맙습니다! 그리고 너희들 메리 크리스마스.
는'NSInterger'는 경솔한 것 뷰에 뷰 컨트롤러를 추가 오타 –