UIScrollView not responding after returning from FlipsideViewController

I have written a simple example where I have a Utility app project with one UIScrollView

on it. When I press the info button to flip the screen and the return is UIScrollView

now unresponsive. Not only that, but I deliberately placed the scroller in the Builder interface in the upper left corner and then programmatically set it in the center. when i come back from flip it moved to the top left corner and didn't react. why?

This is my file .h

:

  #import "POCFlipsideViewController.h"

    @interface POCMainViewController : UIViewController <POCFlipsideViewControllerDelegate, UIScrollViewDelegate>

    @property (nonatomic,retain) IBOutlet UIScrollView *scroller;
    @end

      

This is my .m file

#import "POCMainViewController.h"

@interface POCMainViewController ()

@end

@implementation POCMainViewController


@synthesize scroller =_scroller;

- (void)viewDidAppear:(BOOL)animated
{

     [_scroller setContentSize:CGSizeMake(80.0f, 320.0f)];
     [_scroller setFrame:CGRectMake(120, 131, 80, 214)];

    [super viewDidAppear:animated];
}

- (void)viewDidLoad
{
    _scroller.delegate = self;
    _scroller.showsVerticalScrollIndicator = NO;
    _scroller.decelerationRate = UIScrollViewDecelerationRateFast;

    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Flipside View

- (void)flipsideViewControllerDidFinish:(POCFlipsideViewController *)controller
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([[segue identifier] isEqualToString:@"showAlternate"]) {
        [[segue destinationViewController] setDelegate:self];
    }
}

@end

      

The rest is the boiler plate straight from Xcode. enter image description here

+3


source to share


1 answer


I've found that auto-layout is often the culprit for UIScrollView. In the Storyboard, highlight the view item in the main view controller, and then open the Show File Inspector window in the right column. In the Document Builder Document section, uncheck the Use Auto Layout checkbox and see if that fixes your problem.



enter image description here

0


source







All Articles