zoukankan      html  css  js  c++  java
  • iOS中UIKit——UIButton设置边框

    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];//设置按钮的圆角半径不会被遮挡

        [testButton.layer setCornerRadius:10];

        [testButton.layer setBorderWidth:2];//设置边界的宽度

        

        //设置按钮的边界颜色

        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];

       

      实现效果:

        

     


     

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

  • 相关阅读:
    8.2Solr API使用(Facet查询)
    8.1Solr API使用(分页,高亮)
    7.Solr查询参数
    6.Solr4.10.3API使用(CURD)
    5.Solr4.10.3中配置中文分词器
    3.Solr4.10.3目录结构
    2.Linux环境下配置Solr4.10.3
    1.Solr介绍
    java集合中List与set的区别
    js快速排序
  • 原文地址:https://www.cnblogs.com/123qw/p/4321337.html
Copyright © 2011-2022 走看看