美文网首页iOS、swift技术交流!
UIViewController 添加子controller控制

UIViewController 添加子controller控制

作者: 光明程辉 | 来源:发表于2016-10-31 00:10 被阅读27次

UIViewController 添加子controller控制


//初始化
vc0 = [[SearchTableViewController alloc] init];
[self addChildViewController:vc0];
[self didMoveToParentViewController:vc0];
[self.subView addSubview:vc0.view];
currentVC = vc0;

vc1 = [[DemoDLSildeViewController alloc] init];
[self addChildViewController:vc1];

vc2 = [[Mytest1 alloc] init];
[self addChildViewController:vc2];

vc3 = [[AFDome alloc] init];
[self addChildViewController:vc3];

//使用
[self transitionFromViewController:currentVC toViewController:(vc1) duration:1.0 options:UIViewAnimationOptionAllowAnimatedContent animations:Nil completion:Nil];
[self didMoveToParentViewController:vc1];
[self.subView addSubview:vc1.view];
currentVC = vc1;

相关文章

网友评论

    本文标题:UIViewController 添加子controller控制

    本文链接:https://www.haomeiwen.com/subject/vqguuttx.html