私はUIPageViewController
5つのスクリーンを持っています。下の画像をご覧ください
Screen #1、Screen #2などのラベルの代わりに画像を追加する必要があります。
誰か解決策を教えてください。
私はUIPageViewController
5つのスクリーンを持っています。下の画像をご覧ください
Screen #1、Screen #2などのラベルの代わりに画像を追加する必要があります。
誰か解決策を教えてください。
このコードを試してください..
imageArray 配列に任意の画像を追加します。
NSArray *imageArray=[[NSArray alloc]initWithObjects:@"SpaceTheme.png",@"BeachTheme.png",@"vintage.png", nil];
ScrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320,480)];
[Scroll setPagingEnabled:YES];
[Scroll setShowsHorizontalScrollIndicator:NO];
for(n=0; n< [imageArray count];n++)
{
NSString *imageName=[imageArray objectAtIndex:n];
NSString *fullImageName=[NSString stringWithFormat:@"%@",imageName];
CGRect imageViewFrame;
int padding=20;
imageViewFrame=CGRectMake(Scroll.frame.size.width*n+padding-10,Scroll.frame.origin.y-130,Scroll.frame.size.width-1*padding, Scroll.frame.size.height);
UIImageView *imageView=[[UIImageView alloc]initWithFrame:imageViewFrame];
[imageView setImage:[UIImage imageNamed:fullImageName]];
[imageView setContentMode:UIViewContentModeScaleAspectFit];
[Scroll addSubview:imageView];
pagecontrol.numberOfPages = 3; // Give numbre of pages here
pagecontrol.currentPage = 0;
[self.view addSubview:pagecontrol];
}
Scroll.delegate=(id)self;
CGSize scrollViewSize=CGSizeMake(Scroll.frame.size.width*[imageArray count], Scroll.frame.size.height);
[Scroll setContentSize:scrollViewSize];
[self.view addSubview:Scroll];