Skip to content

Commit

Permalink
Merge pull request #1 from qclmnt/fix-viewIntegration
Browse files Browse the repository at this point in the history
fix-viewIntegration DKCarouselViewItem customView should get same size itemView L236
  • Loading branch information
qclmnt authored Aug 3, 2016
2 parents 10ee53e + 6edc04c commit 5761db3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion DKCarouselView/DKCarouselView.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ typedef void(^DKCarouselViewDidChangeBlock)(DKCarouselView *view, NSInteger inde
// set page changed block
- (void)setDidChangeBlock:(DKCarouselViewDidChangeBlock)didChangeBlock;

// placeholder for DKCarouselURLItem
// placeholder for DKCarouselURLItem
@property (nonatomic, strong) UIImage *defaultImage;

// set infinite slide or not, defaults to NO.
Expand All @@ -61,6 +61,7 @@ typedef void(^DKCarouselViewDidChangeBlock)(DKCarouselView *view, NSInteger inde
@property (nonatomic, assign, getter = isPause) BOOL pause;

// indicator
@property (nonatomic, assign) BOOL indicatorIsVisible; // by default page indicator is visible
@property (nonatomic, strong) UIColor *indicatorTintColor;
@property (nonatomic, assign) CGPoint indicatorOffset; // default offset is CGPointZero, the indicator is centered horizontally.
@property (nonatomic, readonly) CGSize indicatorSize; // returns minimum size for given items.
Expand Down
9 changes: 8 additions & 1 deletion DKCarouselView/DKCarouselView.m
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ - (void)dealloc {

#pragma mark - Public methods

- (void)setIndicatorIsVisible:(BOOL)indicatorIsVisible {
_indicatorIsVisible = indicatorIsVisible;

self.pageControl.hidden = !indicatorIsVisible;
}

- (void)setFinite:(BOOL)finite {
_finite = finite;

Expand Down Expand Up @@ -227,8 +233,9 @@ -(void)setItems:(NSArray *)items {
[itemView sd_setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:self.defaultImage];
} else if ([item isKindOfClass:[DKCarouselViewItem class]]) {
UIView *customView = [(DKCarouselViewItem *)item view];
[itemView addSubview:customView];
customView.frame = itemView.bounds;
customView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[itemView addSubview:customView];
} else {
assert(0);
}
Expand Down

0 comments on commit 5761db3

Please sign in to comment.