无标题文章

2015-05-19  本文已影响0人  15c71b2c9951

一、可翻页的卡片式弹出框的实现

1.首先我们需要自定义绘制一个取消按钮

========

========

=======

-(instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setUp];
    }
    return self;
}

-(id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        [self setUp];
    }
    return self;
}

-(instancetype)init {
    
    return [self initWithFrame:CGRectZero];
}

=======

- (void)setUp {
    
    self.backgroundColor = [UIColor whiteColor];
    
    self.showsTouchWhenHighlighted = YES;
}

=======

2.新建一个类QKInfoCardContainerView继承自UIView用来实现显示区域

=====

@property (assign, nonatomic) CGFloat cornerRadius;//显示区域的圆角

@property (strong, nonatomic) UIColor *containerBackgroundColor;//显示区域的背景色

@property (strong, nonatomic) UIColor *closeButtonTintColor;//关闭按钮的线条颜色

@property (strong, nonatomic) UIColor *closeButtonBackgroundColor;//关闭按钮的背景色

@property (strong, nonatomic) NSArray *containtViews;//用来展示的子控制器
@implementation QKInfoCardContainerView {
    QKInfoCardCloseButton *_closeButton;//关闭按钮
    UIView *_containerView;//展示视图
    UIScrollView *_scrollView;
}

===

-(instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setUp];
    }
    return self;
}

-(id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        [self setUp];
    }
    return self;
}

-(instancetype)init {
    return [self initWithFrame:CGRectZero];
}
上一篇 下一篇

猜你喜欢

热点阅读