uibutton设置

UIButton *selectMore = [UIButton buttonWithType:UIButtonTypeCustom];
            selectMore.frame = CGRectMake(0, __kScreenHeight - 42, __kScreenWidth / 2, 42);
           // UIButton *selectMore = [[UIButton alloc] initWithFrame:CGRectMake(0, __kScreenHeight - 42, __kScreenWidth / 2, 42)];
            NSString *filePath = [[NSBundle mainBundle] pathForResource:@"selectMore" ofType:@"png"];
           // [selectMore setBackgroundImage:[UIImage imageWithContentsOfFile:filePath] forState:UIControlStateNormal];
            [selectMore setBackgroundColor:__kColorWithRGB(240, 241, 243, 1)];
            [selectMore setTitle:@"选择更多商品" forState:UIControlStateNormal];
            [selectMore setTitle:@"选择更多商品" forState:UIControlStateHighlighted];
            selectMore.titleLabel.font = [UIFont boldSystemFontOfSize:22];
            //selectMore.titleLabel.textColor = [UIColor greenColor];
            [selectMore setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
            [selectMore addTarget:self action:@selector(moreClick:) forControlEvents:UIControlEventTouchUpInside];
            [self.view addSubview:selectMore];
            _selectMoreBtn = selectMore;

时间: 2024-07-30 18:25:08

uibutton设置的相关文章

How do I get an image from an UIButton? 如何获取uibutton设置的uiimage

UIImage*img =[button imageForState:UIControlStateNormal];How do I get an image from an UIButton? 如何获取uibutton设置的uiimage,码迷,mamicode.com How do I get an image from an UIButton? 如何获取uibutton设置的uiimage

uibutton 设置圆角边框

[m_selectUserBtr.layer setMasksToBounds:YES]; [m_selectUserBtr.layer setCornerRadius:3]; //设置矩形四个圆角半径 [m_selectUserBtr.layer setBorderWidth:1.0]; //边框宽度 UIColor *ccc = [UIColor colorWithRed:1.00 green:1.00 blue:1.00 alpha:.35]; CGColorRef colorref =

UIButton 设置字体大小

btn.frame = CGRectMake(x, y, width, height); [btn setTitle: @"search" forState: UIControlStateNormal]; //设置按钮上的自体的大小 //[btn setFont: [UIFont systemFontSize: 14.0]];    //这种可以用来设置字体的大小,但是可能会在将来的SDK版本中去除改方法 //应该使用 btn.titleLabel.font = [UIFont sys

UIButton 设置圆角 边框颜色 点击回调方法

UIButton *signBtn = [UIButton buttonWithType:UIButtonTypeCustom]; signBtn.frame = CGRectMake(0, 0, 80, 40); [signBtn.layer setMasksToBounds:YES]; [signBtn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径 [signBtn.layer setBorderWidth:1.0]; //边框宽度 CGColorSpa

iOS UIButton 设置图片文字垂直排列

在实际的iOS项目开发中,我们经常需要改变系统的控件的样式,自己定义一个,同样的当我们发现系统自带的某些方法不好使时,我们也会想到重写这个方法. 本文主要记录笔者设置UIButton图片文字垂直排列的方法,最终解决了在图片和文字垂直排列的情况下,如果文字长度变化会导致图片位置变动的问题,对 于此问题网上有比较多的做法,我就不多说了,在此记录这点细节仅为加深印象并方便以后查阅.如有纰漏还请见谅 方案一:通过调整按钮图片和文字的内边距 UIEdgeInsets typedef struct UIEd

UIButton 设置阴影效果

UIButton有的时候需要用代码做样式调整 其中就包括添加阴影 如下图 中登陆 按钮 此时需要考虑对button的layer进行设置 loginBtn=[UIButton buttonWithType:UIButtonTypeCustom]; loginBtn.frame=CGRectMake(10, 120, 88, 36); loginBtn.backgroundColor=[UIColor colorWithRed:44/255.0 green:178/255.0 blue:219/25

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

iOS开发--UIButton 设置圆角 边框颜色 点击回调方法

1 UIButton *signBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 2 signBtn.frame = CGRectMake(0, 0, 80, 40); 3 [signBtn.layer setMasksToBounds:YES]; 4 [signBtn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径 5 [signBtn.layer setBorderWidth:1.0]; //边框宽度

给UIButton设置阴影及动画组

//设置"开启旅程"按钮 UIButton *startBtn = self.startBtn; CGFloat btnW = 100; CGFloat btnH = 35; CGFloat btnX = (self.dataArray.count) * CGRectGetWidth(self.frame) + self.coreView.bounds.size.width/2-btnW/2; CGFloat btnY = self.coreView.bounds.size.heigh

IOS -UIButton设置边框颜色

1.UIButton边框为浅灰色: CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); CGColorRef color = CGColorCreate(colorSpaceRef, (CGFloat[]){0.1,0,0,0.1}); [_username.layer setBorderWidth:2];//设置边界的宽度 [_username.layer setBorderColor:color];//设置边界的颜色