我想要新闻周刊我喜欢滚动应用程序,如滚动详细新闻。我已经这样做了但它只是滚动。例如,如果你有10篇文章。在第一页上你点击第3条然后它显示第3篇文章详细新闻和滚动保持最多10但不滚动右侧3,2
答案 0 :(得分:0)
同样的问题......没关系
(1)创建视图控制器并从IB添加滚动视图并将其与插座变量
链接-(void)createScrollView
{
myScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 440)];
myScroll.pagingEnabled = YES;
myScroll.showsHorizontalScrollIndicator = YES;
myScroll.showsVerticalScrollIndicator = YES;
myScroll.scrollsToTop = NO;
myScroll.delegate = self;
int n = [array count];
myScroll.contentSize = CGSizeMake((320 * n), 440);
for (int i = 0 , X = 0; i < [photoArray count]; i++ , X += 320)
{
UIImageView *img =[[UIImageView alloc]initWithFrame:CGRectMake(X,0, 320, 480)]; //here web view for you
CGRect frame;
frame.size.width=320; frame.size.height=240;
frame.origin.x=0; frame.origin.y=88;
[img addSubview:asyncImage];
img.contentMode=UIViewContentModeScaleAspectFit;
[myScroll addSubview:img];
}
}
- (void) viewDidLoad
{
[self createScrollView];
[myScroll scrollRectToVisible:CGRectMake(320*photoNumber, 0, 320 , 240) animated:NO];
[self.view addSubview:myScroll];
}
它的示例代码....尝试改变...希望最终为你工作......
答案 1 :(得分:0)
将值传递给photoNumber .. E.g为第3条第3条。