ygweric / eytagview Goto Github PK
View Code? Open in Web Editor NEWEYTagView is a custome view simulate iOS Evernote's tag editing view.
License: Apache License 2.0
EYTagView is a custome view simulate iOS Evernote's tag editing view.
License: Apache License 2.0
解决代码
(EYCheckBoxButton *)tagButtonWithTag:(NSString *)tag
{
EYCheckBoxButton *tagBtn = [[EYCheckBoxButton alloc] init];
tagBtn.colorBg=_colorTagBg;
tagBtn.colorTagUnSelected=_colorTagUnselected;
tagBtn.colorTagBorder=_colorTagBoard;
tagBtn.colorText=_colorTag;
tagBtn.titleLabel.lineBreakMode = 0;
tagBtn.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
tagBtn.colorTagUnBorder=_colorTagUnSelectBoard;
tagBtn.colorUnSelectBg=_colorTagUnSelectBg;
tagBtn.selected=YES;
[tagBtn.titleLabel setFont:_fontTag];
[tagBtn setBackgroundColor:_colorTagBg];
[tagBtn setTitleColor:_colorTag forState:UIControlStateNormal];
[tagBtn addTarget:self action:@selector(handlerTagButtonEvent:) forControlEvents:UIControlEventTouchUpInside];
[tagBtn setTitle:tag forState:UIControlStateNormal];
CGRect btnFrame;
btnFrame.size.height = _tagHeight;
tagBtn.layer.cornerRadius = btnFrame.size.height * self.borderRadius;
CGFloat width=[tagBtn.titleLabel.text sizeWithAttributes:@{NSFontAttributeName:_fontTag}].width + (tagBtn.layer.cornerRadius * 2.0f) + _textPaddingSize.width_2;
if (width>_svContainer.contentSize.width) {
int widhts=_svContainer.contentSize.width-(tagBtn.layer.cornerRadius * 2.0f) + _textPaddingSize.width_2-15;
int height=(ceilf(width/widhts))*[tagBtn.titleLabel.text sizeWithAttributes:@{NSFontAttributeName:_fontTag}].height+5;
_tagHeight=height;
btnFrame.size.height = height;
btnFrame.size.width = widhts;
}else{
btnFrame.size.width = width;
}
tagBtn.frame=btnFrame;
return tagBtn;
}
输入汉字时候,超出TextFiled的宽的时候,点击换行(完成),会显示到第一行
when click tag,don't get click'tag or button
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.