zoukankan      html  css  js  c++  java
  • 一个动画 Label (走马观花)

     

    UILabel中一个水平移动的Label

    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 300, 300)];

        UILabel *label7 = [[UILabel alloc]initWithFrame:CGRectMake(50.0, 380.0, 200.0, 50.0)];

        label.text = @"啦啦啦拉拉,阿拉拉啊 ......";

        label.backgroundColor = [UIColor blackColor];

        label.textAlignment = UIBaselineAdjustmentAlignCenters;

        label.textColor = [UIColor whiteColor];

        [label7 setShadowColor:[UIColor redColor]];

        label7.shadowOffset = CGSizeMake(1.0, 1.0);

        CGRect frame = label7.frame;//一个矩形与Label7 一样的长

        frame.origin.x = -180;//这个矩形在父视图中X轴的开始动画位置

        label.frame = frame;

        [UIView beginAnimations:@"testAnimation" context:NULL];//开始动画

        [UIView setAnimationDuration:8.8f];//设置动画持续的时间(速率)

        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.window cache:YES];//设置动画的翻转方式

        [UIView setAnimationDelegate:self];//设置动画的运行的位置

        [UIView setAnimationRepeatAutoreverses:YES];//是不是设置为自动反向运动

        [UIView setAnimationRepeatCount:999999];//动画播放的次数

        frame = label.frame;

        frame.origin.x = 350;//矩形在父视图运动距离

        label.frame = frame;

        [UIView commitAnimations];

        

        [self.window addSubview:label];

        [label release];

        

  • 相关阅读:
    finalshell连接工具
    oracle11g R2数据库的迁移(同windows系统迁移)使用RMAN
    《python可以这样学》第一章
    python环境开发
    HTTP下帐号密码的截取
    Kail Linux下载与安装
    查看Linux系统内存、CPU、磁盘使用率和详细信息
    内网获取目标的浏览过的所有图片
    修改kali软件源并配置网络
    Python迭代器与生成器
  • 原文地址:https://www.cnblogs.com/meixian/p/4531430.html
Copyright © 2011-2022 走看看