Closed serhatsezer closed 5 years ago
Just create UICollectionViews and UITableViews - you don't need a controller for each view.
Hi @nicklockwood , Thank you for quick response. But i can't get it. I simply want to create two separate carousel where are placed top and bottom. Top carousel view indicate "which view controller now showed" and bottom carousel show collection view controller.
Like this framework ; https://github.com/uacaps/PageMenu
and here is my gist; https://gist.github.com/serhatsezer/0d5200b18d61310d62dc
Thank you so much.
@nicklockwood OK, finally i've find a solution :) still i'm using controllers and I added that controller as a child of current view controller return their views. So i'm using their class methods and own implementations.
Were you able to get this working as a menu? With one carousel controlling another?
@mbcoder17 Yes you can be able to do this by using delegate method. Let say you have two separate iCarousel object and their names are "headerCarousel" and "contentCarousel";
- (void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel {
NSInteger currentItemIndex = carousel.currentItemIndex;
if(carousel == self.headerCarousel) {
[self.contentCarousel scrollToItemAtIndex:currentItemIndex animated:YES];
}
else if(carousel == self.contentCarousel) {
[self.headerCarousel scrollToItemAtIndex:currentItemIndex duration:0.8];
}
}
Thanks, but I think Nick's answer from a different issue will work better:
"Yes, you can sync them perfectly. In the carouselDidScroll delegate event of one carousel set the scrollOffset of the other carousel to match the first one (the scrollOffset is now readwrite and public)"
On Jul 16, 2015, at 4:33 PM, Serhat Sezer notifications@github.com wrote:
@mbcoder17 Yes you can. Let say you have two separate iCarousel object and their names are "headerCarousel" and "contentCarousel";
(void)carouselCurrentItemIndexDidChange:(iCarousel *)carousel {
NSInteger currentItemIndex = carousel.currentItemIndex;
if(carousel == self.headerCarousel) { [self.contentCarousel scrollToItemAtIndex:currentItemIndex animated:YES]; } else if(carousel == self.contentCarousel) { [self.headerCarousel scrollToItemAtIndex:currentItemIndex duration:0.8]; } }
— Reply to this email directly or view it on GitHub.
I want to use different type of view controllers like CollectionViewController and UITableViewController as well as I want to use Controller's delegate methods like viewWillAppear: and viewDidLoad: how can I achive this ?
Simply i'm creating view controllers instance and adding their view to "(CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value" delegation method. But their possition are not appropiate.