How to implement horizontal gallery in iPhone/iPad
HI guys,
I am trying to implement a horizontal gallery like option in my iPad app. I'v heard that there is an option called "gallery" in Android to do this kind of implementation. But, is there any way in which we can implement this feature in iPad..I am attaching a scree开发者_JS百科n shot to make the question more clear.... (gallery can be seen in the bottom of the screen shot)
Allocate a scrollView and call your datas inside it. Hope the below snippet will help you. The snippet will create a horizontal scroll view.
UIScrollView* scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 35, self.frame.size.width, self.frame.size.height-35)];
[self.scrollView setScrollEnabled:YES];
[self.scrollView setDelegate:self];
self.scrollView.backgroundColor = [UIColor clearColor];
[self.scrollView setShowsHorizontalScrollIndicator:NO];
[self.scrollView setIndicatorStyle:UIScrollViewIndicatorStyleDefault];
scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
scrollView.contentMode = UIViewContentModeScaleToFill;
[self.scrollView setContentSize:CGSizeMake("GIVE YOUR WIDTH",0)];
[self.view addSubview:scrollView];
That can help you: https://github.com/Kastet/APCarouselView
You can achieve this using the UIPagecontroll class.
You might also take a look at the PageControl sample code in Xcode.
精彩评论