在一個沒有navigationcontroller的view上跳轉頁面時增長navigatio...

UINavigationController *navigationCon;//先定義一個navigationcontroller的變量 動畫

//下面這個是跳轉頁面的方法 spa

-(void)setnavigationConByBaseViewController:(UIViewController *)viewCon{ animation

    navigationCon = [[UINavigationController alloc] init]; it

    navigationCon.view.frame = CGRectMake(navigationCon.view.frame.origin.x, navigationCon.view.frame.origin.y - 20, navigationCon.view.frame.size.width, navigationCon.view.frame.size.height); io

    [navigationCon pushViewController:viewCon animated:YES]; function

    [self.view addSubview:navigationCon.view]; 變量

    //這裏是動畫效果 方法

    CATransition *animation = [CATransition animation]; im

    [animation setDuration:0.3f]; animate

    [animation setType: kCATransitionMoveIn];

    [animation setSubtype: kCATransitionFromBottom];

    [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];

    [navigationCon.view.layer addAnimation:animation forKey:nil];

    [self.view.layer addAnimation:animation forKey:nil];

}

//調用上面的方法,好比你要跳轉到AController

AController *aController = [[AController alloc] initWithNibName:@"AController" bundle:nil];

[self setnavigationConByBaseViewController:aController];

相關文章
相關標籤/搜索