• 视图翻转


    1.新建一个Empty Application程序

    修改文件appDelegate.m

    在方法- (BOOL)application::添加以下代码:

    //视图,hanjun
    tview = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    tview.backgroundColor = [UIColor redColor];
    [self.window addSubview:tview];

    //创建按钮
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    // btn.titleLabel = @"翻转";
    [btn setTitle:@"翻转" forState:UIControlStateNormal];
    btn.frame = CGRectMake(100, 300, 100, 30);
    [btn addTarget:self
    action:@selector(animateAction:)
    forControlEvents:UIControlEventTouchUpInside];
    [self.window addSubview:btn];

    2.//按钮点击产生的事件(方法)

    - (void) animateAction:(id)sender
    {
    //动画部分
    //动画块
    [UIView beginAnimations:nil context:nil];//动画块的开始
    [UIView setAnimationDuration:0.75];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
    forView:tview
    cache:YES];
    [UIView commitAnimations];//结束动画
    }

    3.commad+r,运行成功即可!

  • 相关阅读:
    python爬虫常见面试题(二)
    python爬虫常见面试题(一)
    回首2018,展望2019
    PDF编辑软件PDFGuru
    打字机NoisyTyper
    文本标注系统
    logstash配置
    服务器上安装python3
    scrapy自调度方案
    前端项目配置nginx配置
  • 原文地址:https://www.cnblogs.com/hanjun/p/2731696.html
Copyright © 2020-2023  润新知