커스텀 탐색 바 및 그 동작을 처리하기 위해 메인 뷰 컨트롤러를 만들고 싶습니다.메인 뷰 컨트롤러를 아웃렛으로 서브 클래 싱하기
그런 다음이 새로운 클래스를 서브 클래 싱하여 동작을 사용하고 각 ViewController에 대해 "contentView"IBOutlet을 연결합니다. 여기
내 BaseViewController.xib입니다 :TestViewController.xib : 부모에 대한
TestViewController.h을 "있는 contentView"콘센트에 연결 :
#import "BaseViewController.h"
@interface TestViewController : BaseViewController
@end
BaseViewController
에서 상속 TestViewController.m : TestViewController.xib의 콘센트를 사용해야합니다. ,TestViewController.xib의 경우 : 6,
- (id)init
{
self = [super init];
if (self) {
[[NSBundle mainBundle] loadNibNamed:@"TestViewController"
owner:self
options:nil];
}
return self;
}
분명히, 나는 흰색보기 및 TestViewController에서 레이블로 MainViewController에서 녹색 막대를 가지고 싶지만, 실제로 작동하지 않습니다, 여기 결과입니다 "보기"콘센트를보기로 연결합니다. 실제로이 화면을 재정의하고 MainViewController의 녹색 막대가 없으므로 가져 오기가 작동하는 것 같아요.하지만 왜 ContentView에서 작동하지 않는지 이해할 수 없습니다. .
아이디어가 있으십니까?
건배!
키릴