您的位置:首页 > 移动开发 > IOS开发

iOS-方形图片设置成圆形图片

2015-10-15 14:09 399 查看




创建一个方形的button,添加方形的背景图片,设置显示为圆形

self.view.backgroundColor=[UIColor
orangeColor];

button=[UIButton
buttonWithType:UIButtonTypeCustom];

button.frame=CGRectMake(0,
0, 200,
200);

button.center=self.view.center;

button.layer.cornerRadius=100;

button.layer.masksToBounds=YES;

button.backgroundColor=[UIColor
orangeColor];

[button
setImage:[UIImage
imageNamed:@"fang"]
forState:UIControlStateNormal];

[self.view
addSubview:button];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: