张运涛

c++

   :: 首页 :: 联系 :: 聚合  :: 管理

常用链接

留言簿(4)

搜索

  •  

最新评论

把一个view分割成四个独立的view,每个子view互不影响

#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width

#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

    UIView* view1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2)];

    UIView* view2 = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2, 0, SCREEN_WIDTH/2, SCREEN_HEIGHT/2)];

    UIView* view3 = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2)];

    UIView* view4 = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/2, SCREEN_HEIGHT/2)];

    view1.backgroundColor = [UIColor redColor];

    [self.view addSubview:view1];

    view2.backgroundColor = [UIColor greenColor];

    [self.view addSubview:view2];

    view3.backgroundColor = [UIColor blueColor];

    [self.view addSubview:view3];

    view4.backgroundColor = [UIColor yellowColor];

    [self.view addSubview:view4];

posted on 2010-07-31 06:38 张运涛 阅读(386) 评论(0)  编辑 收藏 引用 所属分类: iphone

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理