开发者

UIModalTransitionStylePartialCurl half page

开发者 https://www.devze.com 2023-03-26 10:51 出处:网络
I\'m disp开发者_运维技巧laying an UIViewController by the following way: MyViewController *myVc = [[MyViewController alloc] initWithNibName:@\"MyViewController\" bundle:nil];

I'm disp开发者_运维技巧laying an UIViewController by the following way:


MyViewController *myVc = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil];
[myVc setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentModalViewController:myVc animated:YES];

If I'm drawing the MyViewController's view the transition affect only half a page (What I do want).

In my case I'm drawing the entire MyViewController's view so the transition takes affect at the entire view

If I'm drawing only half a view the transition takes affect on half of the screen but I still have 'dead area' that is being shown and isn't drawn.

UIModalTransitionStylePartialCurl half page

My question is how can the transition take affect only for half of the screen (as in the picture) but I still be able to draw the entire view so even if the transition shows only half of the screen, all the shown area will be drawn


iOS only uses the first-level children of the UIView to decide where to position the partial page curl. That allows you to add a 2nd level child view with a frame of e.g. (0, -50, 320, 100) that slips into the area you call the "dead area".


I believe the posters here and in related threads are having problems because they are trying to decorate the background of the underlying view using another view, such as an image view. The correct way to set a background - and which will not affect the page curl, is to actually set the background.

- (void)viewDidLoad {
    [super viewDidLoad];

    //BG
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"StitchTileBG.png"]];
}

Leave using views and such for actual user interface elements


What's the problem here? Populate content in the modalView in such a way that the visible area is utilized. If I am not wrong, the modalPageCurl effect has no option to set the extent of curl (or how much of the screen it should occupy).

So I suggest you skip this approach & focus on trying to cover (or utilize) as much screen is available...


MyViewController * myVc = [[MyViewController alloc] initWithNibName:nil bundle:nil];
[UIView beginAnimations:@"flipPage" context:NULL];
[UIView setAnimationDuration:2];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[self.view addSubview:myVc.view];
[UIView commitAnimations];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号