• <legend id='ITLVT'><style id='ITLVT'><dir id='ITLVT'><q id='ITLVT'></q></dir></style></legend>
  • <small id='ITLVT'></small><noframes id='ITLVT'>

      <i id='ITLVT'><tr id='ITLVT'><dt id='ITLVT'><q id='ITLVT'><span id='ITLVT'><b id='ITLVT'><form id='ITLVT'><ins id='ITLVT'></ins><ul id='ITLVT'></ul><sub id='ITLVT'></sub></form><legend id='ITLVT'></legend><bdo id='ITLVT'><pre id='ITLVT'><center id='ITLVT'></center></pre></bdo></b><th id='ITLVT'></th></span></q></dt></tr></i><div id='ITLVT'><tfoot id='ITLVT'></tfoot><dl id='ITLVT'><fieldset id='ITLVT'></fieldset></dl></div>

      <tfoot id='ITLVT'></tfoot>

          <bdo id='ITLVT'></bdo><ul id='ITLVT'></ul>
      1. 在 Storyboard 中编辑自定义 UIView 子类

        时间:2023-05-31
        <i id='GS7J4'><tr id='GS7J4'><dt id='GS7J4'><q id='GS7J4'><span id='GS7J4'><b id='GS7J4'><form id='GS7J4'><ins id='GS7J4'></ins><ul id='GS7J4'></ul><sub id='GS7J4'></sub></form><legend id='GS7J4'></legend><bdo id='GS7J4'><pre id='GS7J4'><center id='GS7J4'></center></pre></bdo></b><th id='GS7J4'></th></span></q></dt></tr></i><div id='GS7J4'><tfoot id='GS7J4'></tfoot><dl id='GS7J4'><fieldset id='GS7J4'></fieldset></dl></div>

          <small id='GS7J4'></small><noframes id='GS7J4'>

          • <bdo id='GS7J4'></bdo><ul id='GS7J4'></ul>
          • <tfoot id='GS7J4'></tfoot>

                <tbody id='GS7J4'></tbody>
                <legend id='GS7J4'><style id='GS7J4'><dir id='GS7J4'><q id='GS7J4'></q></dir></style></legend>
                1. 本文介绍了在 Storyboard 中编辑自定义 UIView 子类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个应用程序,它使用 UIScrollView 在多个动态生成的 UIView 之间进行分页.现在,我必须以编程方式设置这些 UIView 的布局和 ui 元素,但我想知道是否有任何方法可以在 storyboard 中编辑 UIView 子类的界面(独立于视图控制器).

                  I have an application that uses a UIScrollView to page between a number of dynamically generated UIViews. Right now, I have to programmatically set the layout and ui elements of these UIViews, but I was wondering if there is any way to edit the interface of a subclass of UIView in storyboard (independent of a view controller).

                  提前致谢.

                  仅供参考,我在 iOS 5 中使用 Xcode 4.2.

                  Just for reference, I'm using Xcode 4.2 with iOS 5.

                  推荐答案

                  更新

                  从 Xcode 7 开始,您可以在情节提要中编辑独立视图.将视图从对象库拖到视图控制器的标题栏.Interface Builder 将在视图控制器主视图上方的画布上单独显示独立视图.示例:

                  UPDATE

                  As of Xcode 7, you can edit a standalone view in a storyboard. Drag a view from the Object Library to the header bar of a view controller. Interface Builder will show the standalone view separately on the canvas above the view controller's main view. Example:

                  您可能希望创建一个从视图控制器到独立视图的出口.独立视图只能从包含它的视图控制器访问.

                  You will probably want to create an outlet from your view controller to the standalone view. The standalone view will only be accessible from the view controller that contains it.

                  请注意,当您加载视图控制器时,您会获得一个独立视图的实例.如果您需要多个实例,则没有特别好的方法来获取它们.

                  Note that you get one instance of the standalone view when you load the view controller. If you need multiple instances, there's no particularly good way to get them.

                  在情节提要中没有方便的方法来做到这一点.

                  There is no convenient way to do this in a storyboard.

                  您仍然可以在使用情节提要的项目中创建 nib.因此,您可以为每个视图创建一个 nib,并从您的代码中加载它们:

                  You can still create nibs in a project that uses a storyboard. So you can create a nib for each view, and load them from your code:

                  NSString *nibName = [NSString stringWithFormat:@"page%d", pageNumber];
                  NSArray *nibObjects = [NSBundle.mainBundle loadNibNamed:nibName owner:self options:nil];
                  UIView *pageView = [nibObjects objectAtIndex:0];
                  CGSize size = self.scrollView.bounds.size;
                  pageView.frame = CGRectMake(pageNumber * size.width, 0, size.width, size.height);
                  [self.scrollView addSubview:pageView];
                  

                  这篇关于在 Storyboard 中编辑自定义 UIView 子类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:不推荐使用发布方法 下一篇:自定义左 &amp;右 UISegmentedControl 按钮

                  相关文章

                  最新文章

                  <legend id='ZIPRS'><style id='ZIPRS'><dir id='ZIPRS'><q id='ZIPRS'></q></dir></style></legend>

                  <i id='ZIPRS'><tr id='ZIPRS'><dt id='ZIPRS'><q id='ZIPRS'><span id='ZIPRS'><b id='ZIPRS'><form id='ZIPRS'><ins id='ZIPRS'></ins><ul id='ZIPRS'></ul><sub id='ZIPRS'></sub></form><legend id='ZIPRS'></legend><bdo id='ZIPRS'><pre id='ZIPRS'><center id='ZIPRS'></center></pre></bdo></b><th id='ZIPRS'></th></span></q></dt></tr></i><div id='ZIPRS'><tfoot id='ZIPRS'></tfoot><dl id='ZIPRS'><fieldset id='ZIPRS'></fieldset></dl></div>

                  • <bdo id='ZIPRS'></bdo><ul id='ZIPRS'></ul>
                  1. <tfoot id='ZIPRS'></tfoot>

                      <small id='ZIPRS'></small><noframes id='ZIPRS'>