diff --git a/DKCarouselView/DKCarouselView.h b/DKCarouselView/DKCarouselView.h index eb8335c..831890e 100644 --- a/DKCarouselView/DKCarouselView.h +++ b/DKCarouselView/DKCarouselView.h @@ -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. @@ -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. diff --git a/DKCarouselView/DKCarouselView.m b/DKCarouselView/DKCarouselView.m index 0ed2f91..76b0ab9 100644 --- a/DKCarouselView/DKCarouselView.m +++ b/DKCarouselView/DKCarouselView.m @@ -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; @@ -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); }