12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- //
- // PGIndexBannerSubiew.m
- // NewPagedFlowViewDemo
- //
- // Created by Mars on 16/6/18.
- // Copyright © 2016年 Mars. All rights reserved.
- // Designed By PageGuo,
- // QQ:799573715
- // github:https://github.com/PageGuo/NewPagedFlowView
- #import "PGIndexBannerSubiew.h"
- @implementation PGIndexBannerSubiew
- - (instancetype)initWithFrame:(CGRect)frame {
-
- self = [super initWithFrame:frame];
-
- if (self) {
-
- [self addSubview:self.mainImageView];
- [self addSubview:self.coverView];
- UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleCellTapAction:)];
- [self addGestureRecognizer:singleTap];
- }
-
- return self;
- }
- - (void)singleCellTapAction:(UIGestureRecognizer *)gesture {
- if (self.didSelectCellBlock) {
- self.didSelectCellBlock(self.tag, self);
- }
- }
- - (void)setSubviewsWithSuperViewBounds:(CGRect)superViewBounds {
-
- if (CGRectEqualToRect(self.mainImageView.frame, superViewBounds)) {
- return;
- }
-
- self.mainImageView.frame = superViewBounds;
- self.coverView.frame = superViewBounds;
- }
- - (UIImageView *)mainImageView {
-
- if (_mainImageView == nil) {
- _mainImageView = [[UIImageView alloc] init];
- _mainImageView.userInteractionEnabled = YES;
- }
- return _mainImageView;
- }
- - (UIView *)coverView {
- if (_coverView == nil) {
- _coverView = [[UIView alloc] init];
- _coverView.backgroundColor = [UIColor blackColor];
- }
- return _coverView;
- }
- @end
|