永发信息网

怎么把button变成圆形的ios

答案:2  悬赏:0  手机版
解决时间 2021-11-27 12:24
  • 提问者网友:雪舞兮
  • 2021-11-26 16:09
怎么把button变成圆形的ios
最佳答案
  • 五星知识达人网友:胯下狙击手
  • 2021-11-26 16:21
UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom]];
UIImage *image = [UIImage imageNamed:@"xxx.png"];
[button setBackgroundImage:image forState:UIControlStateNormal];
图片选张圆型的就可以了
如果在xib中拖出来的按钮,就把Type设为custom,然后在BackImage里选张圆型图片
全部回答
  • 1楼网友:旧脸谱
  • 2021-11-26 17:07
设置button完全为圆形: Button.layer.cornerRadius = 34.0;(该值到一定的程度,就为圆形了。) Button.layer.borderWidth = 1.0; Button.layer.borderColor =[UIColor clearColor].CGColor; Button.clipsToBounds = TRUE;//去除边界
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯