zoukankan      html  css  js  c++  java
  • (转)uibutton边框颜色

    UIButton *testButton = [UIButton buttonWithType:UIButtonTypeSystem];

        [testButton setFrame:CGRectMake(self.view.frame.size.width/2self.view.frame.size.height/2100,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];

  • 相关阅读:
    ant design pro梳理
    JSON.stringify()
    数组小细节
    js this细节
    策略模式解决if-else过多
    使用useState的赋值函数异步更新问题
    Hook
    React Api
    Intent
    树的非递归遍历
  • 原文地址:https://www.cnblogs.com/code-changeworld/p/4686671.html
Copyright © 2011-2022 走看看