小编Lar*_*ses的帖子

添加对象后,为什么UIScrollView不能完全滚动?使用storyboard,ARC和Xcode 4.5.2

所以,我知道我的问题也有类似的问题,但也许并不准确(所以请不要让我失望 - 只是警告我或者别的什么).我已经搜索了解决这个简单问题的日子.使用故事板,ARC和Xcode 4.5.2,我只需要在UIScrollView中放置一堆标签并让它垂直滚动.我在viewDidLoad,viewDidAppear和viewWillAppear中尝试了很多设置帧大小和内容大小的组合,但无济于事.滚动视图在其内部没有任何内容时完美滚动,但是当我向其添加标签时,滚动仅滚动非常短的部分.

注意:我需要使用自动布局,否则我的整个项目都会搞砸.

这是我目前的代码......

.h文件:

#import <UIKit/UIKit.h>

@interface MortgageRatesViewController : UIViewController <UIScrollViewDelegate, UIScrollViewAccessibilityDelegate>

- (IBAction)backButton:(id)sender;

@property (strong, nonatomic) IBOutlet UIView *mortgageView;

@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;

@end
Run Code Online (Sandbox Code Playgroud)

.m文件:

#import "MortgageRatesViewController.h"


@interface MortgageRatesViewController ()

@end

@implementation MortgageRatesViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

//-------------------------------------------------------

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage …
Run Code Online (Sandbox Code Playgroud)

iphone storyboard uiscrollview ios autolayout

8
推荐指数
1
解决办法
7264
查看次数

标签 统计

autolayout ×1

ios ×1

iphone ×1

storyboard ×1

uiscrollview ×1