当点击一个tableview单元格时,它会导航到一个新视图,以显示包含图像,描述等内容的详细信息。在页面控制器中显示多个图像可以做什么?
答案 0 :(得分:-1)
在scrollview和页面控制器
中添加图像UIScrollView *image_scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, screenWidth, 200)];
int x=0;
for (int i=0; i<image_ary.count; i++)
{
UIImageView *img=[[UIImageView alloc]initWithFrame:CGRectMake(x, 0,screenWidth, height)];
[image_scrollView addSubview:img];
x=screenWidth+x;
}
[self.view addSubView image_scrollView];
UIPageControl *pageControl = [[UIPageControl alloc] init];
pageControl.frame = CGRectMake(screenWidth/4, pageControlY, 160, 30);
pageControl.numberOfPages = 5;
pageControl.currentPage = 0;
[self.view addSubview:pageControl];
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
float fractionalPage =scrollView.contentOffset.x / screenWidth;
NSInteger page = lround(fractionalPage);
pageControl.currentPage = page;
}