效果
code
//
// ViewController.m
// SampleApple
//
// Created by liuan on 2020/7/17.
// Copyright © 2020 liuan. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIView *view = [[UIView alloc] init];
view.backgroundColor = [UIColor redColor];
view.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:view];
UIView *view2 = [[UIView alloc] init];
view2.backgroundColor = [UIColor blueColor];
view2.frame = CGRectMake(150, 150, 100, 100);
[self.view addSubview:view2];
}
@end