Objective c 为什么不是';我的UIScrollView是否完全滚动?

Objective c 为什么不是';我的UIScrollView是否完全滚动?,objective-c,cocoa-touch,Objective C,Cocoa Touch,我不知道为什么我的UIScroll视图不起作用。我正在学习iOS开发,当我介绍UIScrollView时,我在滚动方面遇到了问题 我创建了一个新项目只是为了检查卷轴,但我没有运气。我正在使用iOS 6.1模拟器和Xcode 4.6.2 这是我的.h文件: #import <UIKit/UIKit.h> @interface CDViewController12 : UIViewController<UIScrollViewDelegate>{ IBOutlet

我不知道为什么我的UIScroll视图不起作用。我正在学习iOS开发,当我介绍UIScrollView时,我在滚动方面遇到了问题

我创建了一个新项目只是为了检查卷轴,但我没有运气。我正在使用iOS 6.1模拟器和Xcode 4.6.2

这是我的.h文件:

#import <UIKit/UIKit.h>

@interface CDViewController12 : UIViewController<UIScrollViewDelegate>{
    IBOutlet UIScrollView *scroll;
}


@end

and my .m file

#import "CDViewController12.h"

@interface CDViewController12 ()

@end

@implementation CDViewController12

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [scroll setScrollEnabled:YES];
    scroll.contentSize = CGSizeMake(250, 2000);
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)dealloc {
    [scroll release];
    [super dealloc];
}
@end
#导入
@接口CDViewController 12:UIViewController{
IBUIScrollView*滚动;
}
@结束
还有我的.m文件
#导入“CDViewController12.h”
@接口CDViewController12()
@结束
@实现CDViewController12
-(id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil
{
self=[super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
如果(自我){
//自定义初始化
}
回归自我;
}
-(无效)viewDidLoad
{
[超级视图下载];
//从nib加载视图后,执行任何其他设置。
}
-(无效)视图显示:(BOOL)动画
{
[超级视图显示:动画];
[滚动设置可滚动:是];
scroll.contentSize=CGSizeMake(2502000);
}
-(无效)未收到记忆警告
{
[超级记忆警告];
//处置所有可以重新创建的资源。
}
-(无效)解除锁定{
[滚动释放];
[super dealoc];
}
@结束

我做错了什么?

尝试停用自动布局属性。 在文件检查器中,取消选中“使用自动布局”框


希望这有帮助

确保滚动视图的大小不大于父视图的大小