手写:
UIlabel *label=[UIlabel alloc] initWithFrame:CGRectMake(320/2-140/2,80,140,40)];
label.text=@"Hello world";
label.textAlignment=NSTextAlignmentCenter;
label.backgroundColor=[UIColor cyanColor];
[self.window addSubView:label];
[label release];
添加控件:View.XIB
NSArray *views=[[NSBoundle mainBoundle] loadNibNamed:@"View" ower:self options:nil];
[self.window addSubView[views lastObject]];