multiple ViewControllers (containerView? childView? instance of viewController?)

梦想的初衷 提交于 2019-12-06 01:21:37
timthetoolman

See the answer here concerning UIViewController containment. I put together an example project on UIViewController containment here: http://github.com/toolmanGitHub/stackedViewControllers

Hope this helps.``

Tim

iLearner

what I understood from your question is, that you want to add a subview to a superview, and which must be user interactable right?

so you can do it by following steps.

1) Add a new view to the xib.
2) make it opaque, set is alpha to less than one(but not zero, depends on you, how much trasparancy u want)
3) add the componats over it, and inside -(IBAction)showWhiteView:(id)sender (in your case) the following code

whiteView.frame = CGRectMake(55, 60, 200, 200);
[UIView beginAnimations:@"" context:nil];
[UIView setAnimationDuration:.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
[self.view addSubview:whiteView];

And to remove it do the following

-(IBAction)removeView:(id)sender
  {
     [whiteView removeFromSuperview];
  }

Dont forget to connect the newly added view.

try it out.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!