您的位置:首页 > 移动开发 > IOS开发

控制界面切换的动画效果

2014-11-21 22:55 267 查看
1.//控制界面切换的动画效果 

MainViewController *mvc = [[MainViewController
alloc]
init];   

    //控制切换的动画风格

mvc.modalTransitionStyle =
UIModalTransitionStyleFlipHorizontal;    

    //当前界面切换到下一个界面

    [self
presentViewController:mvc animated:YES
completion:nil];

把一张图片设置为背景的两种方式:

nc1.navigationBar.backgroundColor =[UIColor
colorWithPatternImage:[UIImage
imageNamed:@"navbg.png"]];

[nc1.navigationBar
setBackgroundImage:[UIImage
imageNamed:@"navbg.png"]
forBarMetrics:UIBarMetricsDefault];

nc1.navigationBar.barStyle =
UIBarStyleBlack;//使title的字体颜色变白经常用,要记住!!!!!!!!!

2. 扩展内容——自定义动画效果

    // QuartzCore
实现动画
   
//

    //1.导入库二进制文件QuartzCore.frameWork
    2.包含头文件

    //<1>创建对象

    CATransition *animation = [CATransition
animation];

    //设置动画类型

    // //@"cube" @"moveIn" @"reveal" @"fade"(default) @"pageCurl" @"pageUnCurl" @"suckEffect" @"rippleEffect" @"oglFlip"
    animation.type =
@"fade";

    //设置动画的方向

    animation.subtype =
kCATransitionFromTop;

    //设置动画时间.0.5秒
    animation.duration =
3;

    //设置动画的节奏

    animation.timingFunction = [CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseOut];

    //animation加入到导航控制器中

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

    

    [self.navigationController
pushViewController:icvc animated:YES];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios 动画