I have an app which in xcode 4.5 and ios 6.1 worked perfectly fine when scrolling. However, after downloading xcode 5 and iOS 7 my scroll views does not work anymore.???
Here is my .h file:
#import <UIKit/UIKit.h>
@interface GrillretterViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIScrollView *grillretterScroller;
@property (assign) CGPoint rememberContentOffset;
@end
And here is my .m file:
#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
PLEASE help! I'm stuck!
Best regards!
I solved this by deselecting 'Use Autolayout' in the File Inspector pane of main view within the Scroll View.
If you want to keep 'Autolayout' enabled, try 'Editor -> Reslove Autolayout Issues -> Add Missing Constraints'. The key constraint appears to be 'Bottom Space to: Superview and in my case was -300, giving 300 scroll space on the botton of the view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With