3

I have a written a simple example where I have a Utility Application project with one UIScrollView on it. When I click the info button to flip the screen and return the UIScrollView now is unresponsive. Not only that but I purposely placed the scroller in the Interface Builder in the upper left corner and then programmatically set it in the center. when I come back from the flipside its shifted up to the top left corner and unresponsive. why?

This is my .h file:

  #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 boiler plate straight from Xcode.enter image description here

4

1 回答 1

0

我发现 UIScrollView 的罪魁祸首通常是自动布局。在 Storyboard 中,突出显示主视图控制器下的视图元素,然后在右侧列中打开“显示文件检查器”窗口。在“Interface Builder Document”下,取消选择“Use Auto Layout”,看看是否可以解决您的问题。

在此处输入图像描述

于 2014-06-25T20:41:09.563 回答