zoukankan      html  css  js  c++  java
  • iPhone控件之UIView

    
    
    - (void)viewDidLoad {

    [super viewDidLoad];

    CGPoint frameCenter = self.view.center;
    float width = 50.0;
    float height = 50.0;

    CGRect viewFrame = CGRectMake(frameCenter.x-width,frameCenter.y-height, width*2, height*2);
    UIView *myView = [[UIView alloc] initWithFrame:viewFrame];
    myView.backgroundColor = [UIColor blueColor];

    //create subview
    CGRect subViewFrame = CGRectInset(myView.bounds, width/2.0, height/2.0);
    UIView *mySubview = [[UIView alloc] initWithFrame:subViewFrame];
    mySubview.backgroundColor = [UIColor yellowColor];

    //set autoresizing mask
    mySubview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

    [myView addSubview:mySubview];

    [[self view] addSubview:myView];

    //animate resize
    [UIView beginAnimations:nil context:NULL];

    [UIView setAnimationDuration:1.0];
    viewFrame = CGRectInset(viewFrame, -width, -height);
    [myView setFrame:viewFrame];

    [UIView commitAnimations];

    [mySubview release];
    [myView release];
    }
  • 相关阅读:
    SpringMVC框架
    Spring框架
    Test_Shop项目开发练习
    MyBatis动态传参
    存储过程
    游标和触发器
    远程连接Linux系统管理
    安装Linux虚拟机
    request_html模块(下)
    request_html模块(上)
  • 原文地址:https://www.cnblogs.com/foxmin/p/2393657.html
Copyright © 2011-2022 走看看