使用自动布局禁用滚动视图

时间:2015-04-03 22:53:02

标签: ios swift uiscrollview xcode6 autolayout

我有一个太大而不适合3.5英寸的视图所以我现在使视图可滚动但是当我使用自动布局使其适合iPhone 6屏幕时,视图不再可以在3.5英寸屏幕上滚动。在照片中没有约束。但是当我添加约束时,视图不再可滚动。

class ProfileViewController: UIViewController, UITableViewDelegate, UIScrollViewDelegate {

    @IBOutlet var scrollView: UIScrollView!

    @IBOutlet var profileView: UIView!


    @IBAction func backToProfileViewController(segue:UIStoryboardSegue) {

    }

    @IBOutlet var profilePictureView: UIImageView!

    @IBOutlet var profileTableView: UITableView!

    @IBOutlet var usernameLabel: UILabel!

    @IBAction func backToProfile(segue:UIStoryboardSegue) {

    }

    @IBAction func goToMailbox(sender: AnyObject) {

        self.performSegueWithIdentifier("mailboxSegue", sender: self)

    }

    @IBAction func logOut(sender: AnyObject) {

        PFUser.logOut()

        self.performSegueWithIdentifier("loggedOutSegue", sender: self)

    }

    @IBAction func editProfile(sender: AnyObject) {

        self.performSegueWithIdentifier("editSegue", sender: self)

    }




    override func viewDidLoad() {

        super.viewDidLoad()
        scrollView.delegate = self
        scrollView.addSubview(profileView)
        //scrollView.scrollEnabled = true
        scrollView.contentSize = CGSizeMake(0, 550)


    }

enter image description here

0 个答案:

没有答案