我有一个在 xcode 4.5 和 ios 6.1 中滚动时运行良好的应用程序。但是,下载 xcode 5 和 iOS 7 后,我的滚动视图不再起作用了。???
这是我的 .h 文件:
#import <UIKit/UIKit.h>
@interface GrillretterViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIScrollView *grillretterScroller;
@property (assign) CGPoint rememberContentOffset;
@end
这是我的 .m 文件:
#import "GrillretterViewController.h"
@interface GrillretterViewController ()
@end
@implementation GrillretterViewController
@synthesize grillretterScroller, rememberContentOffset;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[grillretterScroller setScrollEnabled:YES];
// Do any additional setup after loading the view.
}
- (void) viewDidAppear:(BOOL)animated {
[grillretterScroller setContentSize:CGSizeMake(300, 915)];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:YES];
self.grillretterScroller.contentOffset = CGPointMake(0, 0);
}
- (void)viewWillDisappear:(BOOL)animated {
self.rememberContentOffset = self.grillretterScroller.contentOffset;
[super viewWillDisappear:animated];
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
self.grillretterScroller.contentOffset = CGPointMake(0, self.rememberContentOffset.y);
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
请帮忙!我被困住了!
最好的祝福!