//設置圓角 zheZhaoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 120, 120)]; [zheZhaoView setBackgroundColor:[UIColor colorWithWhite:0.3f alpha:0.8f]]; zheZhaoView.layer.cornerRadius = 10;//設置那個圓角的有多圓 zheZhaoView.layer.borderWidth = 0;//設置邊框的寬度,當然可以不要 zheZhaoView.layer.borderColor = [[UIColor grayColor] CGColor];//設置邊框的顏色 zheZhaoView.layer.masksToBounds = YES; [self addSubview:zheZhaoView];