0
첫 번째 탭 컨트롤러 응용 프로그램을 만들고 있습니다. 그들에 2 UIViews 2 탭이 있습니다. 필자는 Xcode에서 인터페이스 빌더에서 주로이 작업을 수행했으며, firstControllerView 및 SecController 뷰를 두 개 추가했습니다. 탭 컨트롤러가 작동하는 것을 볼 수 있습니다. 앱을 실행했습니다. 탭에서 2 UIView의 배경색을 변경하여 효과를 확인할 수있었습니다.탭의 UIView 내에서 레이블에 연결
이제 secondView에 레이블을 추가하고 코드에서 프로그래밍 방식으로 텍스트를 설정하려고합니다. 이것은 나를 위해 무엇을 깨는 것이다! 나는 잘못된 것을하고있다.
@interface SecondViewController : UIViewController {
IBOutlet UILabel *title;
}
@property (nonatomic,retain) UILabel *title;
@end
을하고하는 .m이 후
#import "SecondViewController.h"
@implementation SecondViewController
@synthesize title;
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[title setText:@"Hello Nick"];
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[title release];
[super dealloc];
}
@end
내가 인터페이스 빌더로 돌아가서 라벨에 출구 참조를 끌고 ... 다음과 같습니다 : 내 SecondViewController.h 그것은 다음과 같습니다 . 시뮬레이터를 실행할 때 충돌이 발생합니다.
무엇이 여기에 있습니까? 그것은 단순해야합니다.
24 시간 후 직접 답변을 수락하십시오. –