我不知道为什么我的 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
我究竟做错了什么?