国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

iOS中UIKit——UIButton設(shè)置邊框

2019-11-14 19:29:16
字體:
供稿:網(wǎng)友

UIButton *testButton = [UIButton buttonWithType:UIButtonTypeSystem];

    [testButton setFrame:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/2, 100, 100)];

    [testButton setTitle:@"獲取屏幕尺寸" forState:UIControlStateNormal];

   

    

    [testButton.layer setMasksToBounds:YES];//設(shè)置按鈕的圓角半徑不會被遮擋

    [testButton.layer setCornerRadius:10];

    [testButton.layer setBorderWidth:2];//設(shè)置邊界的寬度

    

    //設(shè)置按鈕的邊界顏色

    CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();

    CGColorRef color = CGColorCreate(colorSpaceRef, (CGFloat[]){1,0,0,1});

    [testButton.layer setBorderColor:color];

    

    

    [testButton addTarget:self action:@selector(touch) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:testButton];

   

  實現(xiàn)效果:

    

 


 

我的CSDN博客地址:http://blog.csdn.net/qw963895582/article


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 客服| 横峰县| 沈丘县| 伽师县| 阜康市| 永善县| 黄龙县| 黑水县| 泽库县| 宜昌市| 盐亭县| 永丰县| 东明县| 共和县| 黑河市| 嵩明县| 东海县| 昌江| 龙江县| 平顶山市| 天镇县| 金塔县| 白沙| 甘泉县| 郸城县| 新泰市| 保康县| 大同县| 雷波县| 莱州市| 台江县| 抚宁县| 湄潭县| 赤城县| 漯河市| 皮山县| 广宗县| 孝义市| 丽江市| 垦利县| 庆城县|