Giter VIP home page Giter VIP logo

coderjackyhuang / hybimagecliped Goto Github PK

View Code? Open in Web Editor NEW
639.0 23.0 118.0 2.66 MB

开源高效处理圆角的扩展,包括UIImageView、UIView、UIButton、UIImage的扩展API,可根据图片颜色生成图片带任意圆角,可给UIButton根据不同状态处理图片。所有生成图片都不会引起离屏渲染且不会引起离屏、图层混合,支持添加图片边框

License: MIT License

Ruby 0.32% Objective-C 99.68%

hybimagecliped's Issues

是否能设置不同大小的圆角

我看Demo中示例都是设置同样大小的圆角; 请问可以设置这样的圆角: 坐上和左下是10,右上和右下是5,这种样式的圆角.

代码简化

rect.origin.x += borderWidth / 2.0;
rect.origin.y += borderWidth / 2.0;
rect.size.width -= borderWidth;
rect.size.height -= borderWidth;

所有类似上面这样的代码,可以用一行代码代替:
CGRect innerRect = CGRectInset(rect, borderWidth / 2.0, borderWidth / 2.0);

还有-bezierPathWithRoundedRect:cornerRadius:这个方法不应该使用,我们平时对圆角要求不高用一用没什么问题,但是你这是封装。这个贝塞尔曲线的这个方法是有问题的,比如一个边长为200的正方形,理应半径为100才是彻底的圆,但事实上确是:当半径为66~100之间都是彻底的圆,只有小于66才是非整圆,也就是说它存在一个绘制整圆的临界值,然而这个临界值并非边长的一半。

还有一个问题:就是图片超出圆角的部分应该裁剪。你的示例当中设置的圆角都正好不会使得图片超过圆角,你可以设置图片大小为400,半径为40试一试

给imageview设置圆角,四个角出现黑色

_imageV_user_icon = [[UIImageView alloc] initWithFrame:CGRectMake(0, 15, 50, 50)]; [_imageV_user_icon setCenterX:SCREEN_WIDTH / 2.0]; [_imageV_user_icon hyb_addCornerRadius:25.0]; _imageV_user_icon.backgroundColor = whitlTestColor; [self.imageV_Header_BG addSubview:self.imageV_user_icon];
我在写用户信息的头像时候,用以上代码,就出现了四个角黑色。但是我在cell里,用同样的方法,缺没有出现黑色四个角,这是怎么回事?能帮忙解答一样吗?,下面是cell中的代码
self.imageVUserIcon = [[UIImageView alloc] init]; [self.imageVUserIcon hyb_addCornerRadius:15.0]; self.imageVUserIcon.backgroundColor = redTestColor; [self.contentView addSubview:self.imageVUserIcon]; [self.imageVUserIcon mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).offset(leftSpace); make.width.height.equalTo(@30); make.centerY.equalTo(self.contentView); }];

collectionView加圆角没有效果

[self.collectionView hyb_addCorner:UIRectCornerTopLeft |UIRectCornerTopRight |UIRectCornerBottomLeft|UIRectCornerBottomRight cornerRadius:8];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.