Iphone 连接到选项卡的UIView中的标签

Iphone 连接到选项卡的UIView中的标签,iphone,Iphone,我正在创建我的第一个选项卡控制器应用程序。我有两个选项卡,其中包含两个UIView。我主要是从Interface Builder完成的,我在Xcode中所做的就是添加两个文件firstControllerView和SecController view。当我运行应用程序时,我可以看到选项卡控制器正在工作(我只是简单地更改了选项卡中2个UI视图的背景色以查看效果) 现在,我想向secondView添加一个标签,并通过代码以编程方式设置其文本。这对我来说太糟糕了!我做错了什么事。在我的SecondVi

我正在创建我的第一个选项卡控制器应用程序。我有两个选项卡,其中包含两个UIView。我主要是从Interface Builder完成的,我在Xcode中所做的就是添加两个文件firstControllerView和SecController view。当我运行应用程序时,我可以看到选项卡控制器正在工作(我只是简单地更改了选项卡中2个UI视图的背景色以查看效果)

现在,我想向secondView添加一个标签,并通过代码以编程方式设置其文本。这对我来说太糟糕了!我做错了什么事。在我的SecondViewController.h中,它如下所示:

@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
在这之后,我回到Interface Builder并将outlet引用拖到标签上。当我运行模拟器时,它崩溃了


我错过了什么?它必须很简单。

忘记在应用程序代理中为tabbar控制器创建一个插座,然后将该插座连接到interface builder中的tabbar控制器。

请在24小时计时器后接受您自己的答案。