我在 XCode 界面构建器中建立一个 UI 。 在设定了所需的视图等级后, 我意识到, 靠近该等级顶端的视图之一应该是 UIScrollView
, 而不是 UIView
。
是否有办法可以轻易地改变这种观点, 从UIView到UIScrollView, 而不必用他们自己的子视图等级重置所有儿童组成部分?
我在 XCode 界面构建器中建立一个 UI 。 在设定了所需的视图等级后, 我意识到, 靠近该等级顶端的视图之一应该是 UIScrollView
, 而不是 UIView
。
是否有办法可以轻易地改变这种观点, 从UIView到UIScrollView, 而不必用他们自己的子视图等级重置所有儿童组成部分?
是的, 请单击您想要更改的 < code> UIView code> 。 在选中它后, 打开身份检查器窗格 。
从身份检查员那里,你应该看到最上面命名为“类”的字段,以灰色字表示的当前值应该是“UIView”。
输入 UIScroll View 并点击 Enter 。
这将更新您的 Nib 文件以及我之前的 UIOView
到 UIScrollView
。 此外, 如果您已经将视图连接到 IB Outlet
, 请确定您更新了 IBoutlet
类定义, 如果它不是 id
。
据我所知,最简单的方式是右键单击相应的.xib 文件,然后选择 Opern As -- & gt; source Code
。然后您可以找到您想要更改的视图。它看起来是这样的 。
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0gr-sH-vvn">
.
.
.
</view>
换成
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0gr-sH-vvn">
.
.
.
</scrollView>
基本上,您需要将 view
更改为 scrollView
,当您在界面构建者情绪 < em> 下通过属性检查员部分修改这些属性时,其他属性将自动生成(右键单击.xib 文件,并选择 Opern As -- & gt;界面构建器 XIB Document
)
Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...
I m using Xcode on OSX to develop command line C applications. I would also like to use Instruments to profile and find memory leaks. However, I couldn t find a way to display the console when ...
Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...
I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....
This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...
我跑了X条码,试图把我的手套放在我的电话上。 I m 获取错误信息:“正在设计的方案没有运行”。
Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...
In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...