iphone - 如何自定义段 Controller

标签 iphone ios uisegmentedcontrol

首先,如果我的问题不恰当,请原谅我。我浏览了一些教程来自定义 ios 中的 uisegment Controller 。他们所做的是创建 UISegmentedControlUIControl

的子类

我的问题是

当您创建 UISegmentControl 或 UIControl 的子类时,幕后的目的是什么

最佳答案

子类化 UISegmentedControl 或 UIControl 的目的与子类化任何其他类的目的相同 - 因为您希望扩展或更改基类的行为。 UIControl 有点像 UIViewController。您永远不会创建 UIViewController 的实例。您始终创建子类来为您的应用程序创建特定的 View Controller 。 UIControl 类似。它为您提供基本的 UI 控制功能,但不提供任何特定的控制。您可以对 UIControl 进行子类化,以创建 SDK 未提供的您自己的、独特的 UI 控件。

关于iphone - 如何自定义段 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12897553/

相关文章:

iphone - 在 UIScrollView 中滚动到屏幕中心

ios - 在 iOS 上流式传输 RTSP 时接收 "End of file"

iPhone:如何以编程方式回复短信

ios - 通过 navigationController 使用 segue 传递数据

ios - 如何在 UISearchBar 中的范围按钮上设置不同的宽度?

iphone - 带有标题标签的 UILabel(或 UITextField)

ios - UITextField 麻烦

ios - 如何彻底去除 iOS 状态栏

iOS Swift - 使用 UISegmentedControl 更改 UIPageViewController 页面

ios - 在父 View Controller 中点击按钮时容器 View 丢失 textField 值