| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- //
- // IntroView.m
- // model
- //
- // Created by Drew on 2018/11/1.
- // Copyright © 2018年 Mine. All rights reserved.
- //
- #import "IntroView.h"
- @interface IntroView()
- @property(nonatomic, strong) Callback confirm;
- @property(nonatomic, strong) Callback cancel;
- @end
- @implementation IntroView
- - (instancetype)initWithFrame:(CGRect)frame confirm:(void(^)())confirm cancel:(void(^)())cancel {
- if (self = [super initWithFrame:frame]) {
- [self initView];
- self.confirm = confirm;
- self.cancel = cancel;
- }
- return self;
- }
- - (instancetype)initWithCoder:(NSCoder *)aDecoder {
- if (self = [super initWithCoder:aDecoder]) {
- [self initView];
- }
- return self;
- }
- - (void)initView {
- NSBundle *bundle = [NSBundle bundleForClass:[self class]];
- NSString *className = NSStringFromClass([self class]);
- UIView *view = [[bundle loadNibNamed:className owner:self options:nil] firstObject];
- view.frame = self.bounds;
- [self addSubview:view];
- self.backgroundColor = [UIColor clearColor];
- }
- - (IBAction)confirm:(id)sender {
- [self removeFromSuperview];
- if (self.confirm) {
- self.confirm();
- }
- }
- - (IBAction)cancel:(id)sender {
- [self removeFromSuperview];
- if (self.cancel) {
- self.cancel();
- }
- }
- @end
|