Part of the code is as follows, looking great God enlighten ah!
FVc:
- (Void) viewDidLoad
{
[Super viewDidLoad];
if (AVc == nil)
{
AVc = [[AVCViewController alloc] init];
}
[Self.view addSubview: AVc.view];
if (BVc == nil)
{
BVc = [[BVCViewController alloc] init];
}
[Self.view addSubview: BVc.view];
}
AVc:
- (Id) init
{
if (self = [super init])
{
self.view.backgroundColor = [UIColor brownColor];
/ / NSLog (@ "frame.width =% f frame.height =% f", self.view.frame.size.width, self.view.frame.size.height);
self.view.frame = CGRectMake (0,0,200, self.view.frame.size.height);
}
}
BVc:
- (Id) init
{
if (self = [super init])
{
self.view.backgroundColor = [UIColor brownColor]; / / phrase if one adds the words change color, but if you take in to view directly in the xib change the color look, you do not see
/ / NSLog (@ "frame.width =% f frame.height =% f", self.view.frame.size.width, self.view.frame.size.height);
self.view.frame = CGRectMake (201,0, self.view.frame.size.width - 1, self.view.frame.size.height);
}
return self;
}
BVc.view this area are shown in the FVc.view color, the color does not show BVc.View and above UILable not displayed, AVc.view area on no problem.
Reply:
Their top, help ah
Reply:
Why storyboard it? 4.3 are not up and running
Reply:
If you use IBout what's statement, then you do not need to continue to go in ViewDIdLoad alloc and init a new class of.
You should ViewController init method, do some AddSubView operation.
I think the same category ViewController, you generate two times, that is, there are two in the same category ViewController, one identifies you to XIB, then ViewDidLoad the time, and there is no corresponding AddSUbView to your logo ViewController, but the identification ViewController to a new generation on.
No comments:
Post a Comment