Iphone UIScrollView抵销内容是请求金额的两倍 问题

Iphone UIScrollView抵销内容是请求金额的两倍 问题,iphone,uikit,uiscrollview,Iphone,Uikit,Uiscrollview,我的PSWSnapshotView的快照索引在滚动视图(40px偏移量)的右侧太远。但是,它们的帧设置为第一个帧位于(0,0),尽管第一个帧显示在(snapshotInset,0)处,而不是:/ 代码 -(无效)布局视图 { CGRect frame=self.frame; CGFloat pageWidth=frame.size.width-(快照插图*2); CGRect pageFrame=CGRectMake(0.0f,0.0f,pageWidth,frame.size.height);

我的PSWSnapshotView的快照索引在滚动视图(40px偏移量)的右侧太远。但是,它们的帧设置为第一个帧位于(0,0),尽管第一个帧显示在(snapshotInset,0)处,而不是:/

代码
-(无效)布局视图
{
CGRect frame=self.frame;
CGFloat pageWidth=frame.size.width-(快照插图*2);
CGRect pageFrame=CGRectMake(0.0f,0.0f,pageWidth,frame.size.height);
NSInteger pageCount=[应用程序计数];
[pageControl setNumberOfPages:pageCount];
[scrollView setFrame:CGRectMake(snapshotInset,0.0f,页面宽度,框架.大小.高度)];
[scrollView setContentSize:CGSizeMake((pageWidth*pageCount)+1.0f,frame.size.height)];
for(int i=0;i如果([snapshotViews count]您是否可能在某个位置设置scrollView.contentOffset,与此无关?而且,这可能只是一个复制/粘贴问题,您同时引用snapshotInset和_snapshotInset

- (void)layoutViews
{
    CGRect frame = self.frame;
    CGFloat pageWidth = frame.size.width - (snapshotInset * 2);
    CGRect pageFrame = CGRectMake(0.0f, 0.0f, pageWidth, frame.size.height);
    NSInteger pageCount = [applications count];

    [pageControl setNumberOfPages:pageCount];
    [scrollView setFrame:CGRectMake(snapshotInset, 0.0f, pageWidth, frame.size.height)];
    [scrollView setContentSize:CGSizeMake((pageWidth * pageCount) + 1.0f, frame.size.height)];

    for (int i = 0; i < pageCount; i++) {
        PSWSnapshotView *view;
        if ([snapshotViews count] <= i)
        {
            PSWSnapshotView *view = [[PSWSnapshotView alloc] initWithFrame:pageFrame application:[applications objectAtIndex:i]];
            view.delegate = self;
            [scrollView addSubview:view];
            [snapshotViews addObject:view];
            [view release];
        }
        else
        {
            view = [snapshotViews objectAtIndex:i];
            [view setFrame:pageFrame];
        }

        pageFrame.origin.x += pageWidth;
    }
}