Made a simple example
addsubview
view add another view
viewController1.m
...
viewController2 * v2 = [[viewController2 alloc] init];
[Self.view addsubView: v2.view]
...
Does not show v2.view
But [[self.view subviews] count] but output 1, which means that has joined
This is how it
Thank you
Reply:
viewController2 there in - (void) loadView initialize view contents yet? If so, it should be displayed
Reply:
What do you mean?
I use the storyboard,
Pull out viewcontroller2, I just set its background = storyboard blue
Then viewController1 in [self.view addsubView: v2.view]
The results did not show a blue
Reply:
storyboard, you initialize the controller can not use
viewController2 * v2 = [[viewController2 alloc] init];
Initialize and you do not pass storyboard to generate views.
Instead, use:
UIStoryboard * storyboard = [UIStoryboard storyboardWithName: @ "MainStoryboard" bundle: nil];
viewController2 * v2 = [storyboard instantiateViewControllerWithIdentifier: @ "vc2"];
If so, then you can be initialized using stroyborad design view it.
Reply:
Thank you,
But after I joined a tabelview, how this tableview can be shown that over that part of the screen, slide out point, it stops sliding, and went back to the first line?
Reply:
May be your UITableView's frame set incorrectly caused. You check again.
Reply:
I did not set the frame
Just a default uitableviewcontroller
But I was in view1 down into a sub-view (sub-view only part of the page), and then in the sub-view of the inner addsubview
Tablecontroller * table = [[Tablecontroller alloc] init];
[Self addChildViewController: table];
[[Self.view viewWithTag: 1] addSubview: table.view];
Reply:
Always set the rect view it, or will be 0,0,0,0
No comments:
Post a Comment