我有一个应用程序,在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
请帮忙!我卡住了!
最好的祝福!