如何在 Xcode5 中使用 AutoLayout 制作 ScrollView

How to make a ScrollView with AutoLayout in Xcode5(如何在 Xcode5 中使用 AutoLayout 制作 ScrollView)
本文介绍了如何在 Xcode5 中使用 AutoLayout 制作 ScrollView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用情节提要的 xcode 5 中,如何在启用自动布局的情况下制作一个完全可操作的垂直滚动滚动视图?
考虑到子视图有层次结构:

In xcode 5 using storyboards how would one make a fully operational vertical scrolling scrollview, with AutoLayout ON?
Considering the subviews have hierarchy:

  1.UIView  
    2.UIScrollView
      3.UIView (lets call this UIDetailView to make things easier)

请从代码到约束具体到任何视图是否必须更小等.

Please be specific from code to constraints to wether any of the views HAS to be smaller etc.

推荐答案

这篇博文详细介绍了如何使用 UIScrollView 和 Autolayout ON,使用纯自动布局方法.请注意,博客文章中的所有约束都是通过情节提要定义的.

This blog post details how to use a UIScrollView with Autolayout ON, using a pure autolayout approach. Note though that all constraints in the blog post are defined through the Storyboard.

帖子中的方法假定以下层次结构:

The approach in the post assumes the following hierarchy:

1. View (main view of my UIViewController)
  2. Scroll View (UIScrollView)
     3. Container View (UIView)
       4. Content View (e.g. UIImageView)

我猜容器视图将是您的 UIDetailView,而内容视图将是您的 UIDetailView 中的任何 UIView.

I guess the Container View will be your UIDetailView, and the Content View will be any UIView inside your UIDetailView.

https://happyteamlabs.com/blog/ios-how-to-use-uiscrollview-with-auto-layout-pure-auto-layout/

这篇关于如何在 Xcode5 中使用 AutoLayout 制作 ScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Why local notification is not firing for UNCalendarNotificationTrigger(为什么没有为UNCalendarNotificationTrigger触发本地通知)
iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
tabbar middle tab out of tabbar corner(选项卡栏中间的选项卡角外)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)