zoukankan      html  css  js  c++  java
  • 视图翻转

    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,运行成功即可!

  • 相关阅读:
    HTML 图片文字滚动
    Request.QueryString的用法
    细线表格的制作
    photoshop的小小快捷键
    制作首页
    css
    编写BLL层
    完成新闻表操作类
    编写剩下的存储过程
    重构SQLHelper2
  • 原文地址:https://www.cnblogs.com/hanjun/p/2731696.html
Copyright © 2011-2022 走看看