为什么我的UIScrollView没有完全滚动?

时间:2013-08-20 14:47:59

标签: objective-c cocoa-touch

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

我创建了一个新项目来检查滚动,但我没有运气。我正在使用带有Xcode 4.6.2的iOS 6.1模拟器。

这是我的.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

我做错了什么?

2 个答案:

答案 0 :(得分:0)

尝试停用自动布局属性。 在文件检查器中,取消选中“#34;使用AutoLayout&#34;

”框 希望这有帮助!

答案 1 :(得分:0)

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

相关问题