把一个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];