Iphone UIScrollview分页式动画
我有一个视图,其中有一些图像、文本和更多内容要显示,当用户单击左侧或右侧按钮时,左侧和右侧有两个按钮。按钮页面应显示在一侧,另一个页面应显示新信息Iphone UIScrollview分页式动画,iphone,objective-c,ios,Iphone,Objective C,Ios,我有一个视图,其中有一些图像、文本和更多内容要显示,当用户单击左侧或右侧按钮时,左侧和右侧有两个按钮。按钮页面应显示在一侧,另一个页面应显示新信息 我怎么做请帮忙 试试这个。你会得到解决问题的逻辑。在需要的每一侧放置一个按钮&使用此线程的逻辑为scrollview启用分页 点击按钮时,使用setContentOffset:animated按scrollview的宽度修改scrollview的内容偏移量:使用此代码 -(IBAction)prevButtonPage:(id) sender {
我怎么做请帮忙 试试这个。你会得到解决问题的逻辑。在需要的每一侧放置一个按钮&使用此线程的逻辑为scrollview启用分页 点击按钮时,使用setContentOffset:animated按scrollview的宽度修改scrollview的内容偏移量:使用此代码
-(IBAction)prevButtonPage:(id) sender
{
CGFloat xOffset = pagingScrollView.contentOffset.x;
CGFloat yOffset = pagingScrollView.contentOffset.y;
if (pagingScrollView.contentOffset.x != pagingScrollView.frame.origin.x)
{
[pagingScrollView setContentOffset:CGPointMake(xOffset- 320, yOffset) animated:YES];
// [arrayIndia objectAtIndex:i];
}
NSLog(@" custom x==%f %f", pagingScrollView.contentOffset.x, pagingScrollView.contentSize.width);
}
-(IBAction)nextButtonPage:(id) sender
{
CGFloat xOffset = pagingScrollView.contentOffset.x;
CGFloat yOffset = pagingScrollView.contentOffset.y;
if ((pagingScrollView.contentOffset.x != pagingScrollView.frame.origin.x)&&(pagingScrollView.contentOffset.x !=[imageArray count]) )
{
[pagingScrollView setContentOffset:CGPointMake(xOffset + 320, yOffset) animated:YES];
}
NSLog(@" custom x==%f %f", pagingScrollView.contentOffset.x, pagingScrollView.contentSize.width);
}