Iphone 更改水平滚动上滚动视图滚动宽度的大小

Iphone 更改水平滚动上滚动视图滚动宽度的大小,iphone,objective-c,cocoa-touch,Iphone,Objective C,Cocoa Touch,我想做一个水平卷轴 这是我的密码 int frameSize = 140; for (int i = 0; i < self.handArray.count + 10 ; i++) { CGRect frame; frame.origin.x = i * frameSize; frame.origin.y = 0; frame.size = CGSizeMake(130, 130); UIView *view = [[UIView alloc]

我想做一个水平卷轴

这是我的密码

int frameSize = 140;

for (int i = 0; i < self.handArray.count + 10 ; i++)
{
    CGRect frame;
    frame.origin.x = i * frameSize;
    frame.origin.y = 0;
    frame.size = CGSizeMake(130, 130);

    UIView *view = [[UIView alloc] initWithFrame:frame];
    view.backgroundColor = [UIColor whiteColor];

    UIImage *image;
   // if (i == 0)
    image = [UIImage imageNamed:@"halo.png"];
    //else
       // image = [UIImage imageWithContentsOfFile:[self.handArray objectAtIndex:i]];
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];

    [btn setImage:[UIImage imageNamed:@"cross_red.png"] forState:UIControlStateNormal];
    btn.tag = i;
    btn.frame = CGRectMake(102, 0, 29, 29);

    [btn addTarget:self action:@selector(deleteHandBtnPressed:) forControlEvents:UIControlEventTouchUpInside];

    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    imageView.frame = CGRectMake(10, 10, 120, 120);        
    [view addSubview:imageView];
    if (i != 0)
        [view addSubview:btn];

    [self.handScrollView addSubview:view];
}

[self.handScrollView setContentSize:CGSizeMake(frameSize * (self.handArray.count + 10), self.handScrollView.frame.size.height)];
int frameSize=140;
对于(int i=0;i
下面是图片


您可以看到,我为特定区域定义了scrollView,但图像分布在整个屏幕上。如何限制滚动视图的滚动宽度。

如果我正确理解了您的问题(这很难),请尝试


您是否尝试在xib文件上设置自动重新设置密钥

如果没有,请按下图所示进行尝试:


请附上屏幕截图,说明它是如何出现的?我不清楚你的问题。.滚动视图正扩展到iPhone 320的整个宽度,我已将其设置为280英寸,仅此而已。)
self.handScrollView.clipsToBounds = YES;