boai / babutton Goto Github PK
View Code? Open in Web Editor NEW自定义button
License: Other
自定义button
License: Other
-(UIButton *)commitBtn
{
if (!_commitBtn)
{
_commitBtn = [UIButton ba_creatButtonWithFrame:CGRectZero title:@"完成" selTitle:@"完成" titleColor:KBackgroundColor_FF titleFont:[UIFont systemFontOfSize:16] image:nil selImage:nil padding:0 buttonPositionStyle:BAKit_ButtonLayoutTypeNormal viewRectCornerType:BAKit_ViewRectCornerTypeAllCorners viewCornerRadius:8 target:self selector:@selector(commitBtnClick)];
}
return _commitBtn;
}
}
只要不用设置圆角的都能正常显示。一设置就没戏。救救孩子~
图片上文字下:一旦图片的高度的80%大于按钮高度的50%,就会出现图片显示不全的问题以及文字会有一部分压在图片上
文字上图片下:一旦图片的高度的80%大于按钮高度的50%,就会出现图片显示不全的问题
后来一直用masonry,几乎不设置button的frame,能不能出个友好适配masonry的
图上文下布局时,如果文字太少,就无法居中,而是偏右
您好,我发现不能调整BAButton内部ImgView的大小,它的大小只能根据button的大小自动生成,这样不太友好吧
#define BAKit_SCREEN_WIDTH ((([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.height)
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds
byRoundingCorners:corners
## cornerRadii:CGSizeMake(20.0, 30.0)];
CAShapeLayer *maskLayer = [CAShapeLayer layer];
maskLayer.frame = self.bounds;
maskLayer.path = maskPath.CGPath;
self.layer.mask = maskLayer;
设置buttonCornerRadii不生效 看代码这边貌似是写死成CGSizeMake(20.0, 30.0),可以修改一下
另外是否可以加一个padding参数 来设置图片和文字之间的间隔呢,尤其是在水平布局的话有这种需求
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.