0

I'm new to XCode and am having trouble getting a subView, when added to the main view, to originate from the bottom whereas the top (which I presume is default). When I mean top, I don't mean the heir-achy but rather literally top of the screen (where the power button and ear jack of an iphone is).

I have tried to play around with the View -> Origin, and View -> Mode - neither did anything. I would assume it's the auto-layout but I can't be sure.

Basically, I have a colored mainStoryboard and it [self.view addSubView:[[AnotherView alloc] initWithNibName:@"AnotherView" bundle:nil]];

The AnotherView is just a empty half-sized View. When it gets added, it keeps appearing from the top. I don't know how to make it come from the bottom.

Do you guys have any insight as to how I might be able to make it come from the bottom?

Thanks ahead of time!

4

1 に答える 1

1

フレームを使用して newView を self.view に追加します

newView.frame=CGRectMake(0,480,320,200);

その後、以下のアニメーションを使用してそのビューをアニメーション化します。

 [UIView animateWithDuration:0.4 delay:0.0 options:UIViewAnimationTransitionCurlUp
                             animations:^{

    newView.frame=CGRectMake(0,0,320,200);

     } completion:nil];

または、使用できます

presentModalViewController: アニメーション:

方法

于 2013-06-12T04:19:36.917 に答える