0
我不知道爲什麼我的UIScroll視圖不起作用。我只是在學習iOS開發,當我介紹UIScrollView時,我在滾動時遇到了問題。爲什麼我的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
我在做什麼錯?