ios - 操作表 IOS 中的分段控制

标签 ios uisegmentedcontrol uiactionsheet custom-view uialertcontroller

我正在尝试以与苹果 map 应用程序相同的方式在操作表中添加分段控件。 enter image description here

我找到了一种在操作 TableView 中添加为 subview 的方法,但苹果不建议这样做。我在某处发现了以下评论。

You might want to be careful with this. Apple may not like it. From the documentation: "UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy. If you need to present a sheet with more customization than provided by the UIActionSheet API, you can create your own and present it modally with presentViewController:animated:completion:." – Eric Goldberg Mar 4 '14 at 2:28



谁能建议我实现这一目标的方法。

最佳答案

多年来,我也一直试图弄清楚这一点。线索在左下角——线条并没有一直延伸到左边缘。它实际上是一个 UITableView 并且行之间的间隙实际上是具有自定义大小的空白节标题。

我还没有完全实现它,但重要的是:

  • 在 Storyboard 中制作一个新的 UIViewController。
  • 在 ViewController 属性选择器集 PresentationOver Current Context
  • 在 View 中,更改 BackgroundClear Color
  • 添加一个 UITableView。设置左、下、右约束。设置 TableView 的高度,使其仅覆盖 View 的下半部分
  • 更改StyleGrouped
  • 像基于普通原型(prototype)的 TableView
  • 一样实现委托(delegate)
  • 从操作按钮创建一个到 ViewController 的 segue 并设置 SeguePresent Modally
  • 关于ios - 操作表 IOS 中的分段控制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31586639/

    相关文章:

    ios - 在 iPad 上显示来自 ActionSheet 的 ImagePickerController

    iphone - 如何将字符串数组发送到 UIActionSheet varargs init 方法中?

    javascript - 苹果手机SDK : How to get rid of the action sheet in UIWebView?

    ios - 更改 EXIF 数据以正确识别 iPhone

    objective-c - 在主线程或后台线程上进行iOS XML解析

    jquery - 100% DIV 不拉伸(stretch) iphone 3gs 和 4

    ios - 从 ContainerView 内部切换到另一个 ContainerView

    javascript - 在 iPhone 中加载 HTML 资源

    ios - 如何为 UISegmentedControl 设置阴影?

    ios - Swift:从动态 SegmentedControl 获取值