CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

CJMViewCategory 0.1.0

CJMViewCategory 0.1.0

Maintained by chenjm.



  • By
  • chenjm

CJMViewCategory

CI Status Version License Platform

视图的接口扩展,包括UIButton的点击动画,UIView的圆角设置,查找父视图等。

  • UIButton (CJMViewAnimated):通过touch事件处理button的动画效果,不需要设置UIButton的事件。
  • UIView (CJMViewRoundCorner):设置view的圆角,可以单独设置4个角的其中一项或几项。兼容iOS11以下的情况。
  • UIView (CJMViewFind):通过子视图和父视图的类型找到父视图的实例。一般用于UITableViewCell的子视图反查UITableView实例的情况。

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

  • UIButton (CJMViewAnimated)
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(50, 200, 60, 40)];
[self.view addSubview:button];
UIImage *image = [UIImage imageNamed:@"left.jpeg"];
[button setImage:image forState:UIControlStateNormal];
button.cjmv_animated = [CJMViewAnimated new];
button.adjustsImageWhenHighlighted = NO;
  • UIView (CJMViewRoundCorner)
CJMViewRoundCorner *corner = [[CJMViewRoundCorner alloc] init];
corner.maskedCorners = CJMViewMaskedCornersTop;
corner.maskedColor = [UIColor redColor];
corner.shadowRadius = 4;
corner.shadowOpacity = 1.0;
corner.shadowColor = [UIColor blueColor];
corner.shadowOffset = CGSizeMake(4, 4);
corner.borderWidth = 1.0;
corner.borderColor = [UIColor blackColor];
corner.radius = 20;

UIView *redView = [[UIView alloc] init];
redView.backgroundColor = [UIColor redColor];
[self.view addSubview:redView];
redView.cjmv_corner = corner;
redView.translatesAutoresizingMaskIntoConstraints = NO;

[NSLayoutConstraint activateConstraints:@[
    [redView.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:50],
    [redView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:50],
    [redView.widthAnchor constraintEqualToConstant:100],
    [redView.heightAnchor constraintEqualToConstant:100],
]];
  • UIView (CJMViewFind)
UITableView *tableView = [self findTableView];

Requirements

Installation

CJMViewCategory is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'CJMViewCategory'

Author

chenjm, [email protected]

License

CJMViewCategory is available under the MIT license. See the LICENSE file for more info.