简体   繁体   English

如何自定义细分控制器

[英]how to customize segment controller

First of all, pardon me if my question is inappropriate. 首先,如果我的问题不合适,请原谅我。 I went thru some tutorials to customize the uisegment controller in ios. 我浏览了一些教程,以在ios中自定义uisegment控制器。 What they do is they create a subclass either of UISegmentedControl or UIControl 他们要做的是创建UISegmentedControlUIControl的子类。

My question is 我的问题是

what is the purpose behind the scene when you do a subclass of UISegmentControl or UIControl 当您执行UISegmentControl或UIControl的子类时,幕后的目的是什么

The purpose of subclassing UISegmentedControl or UIControl is the same purpose as subclassing any other class - because you wish to extend or alter the behavior of the base class. 子类化UISegmentedControl或UIControl的目的与子类化其他任何类的目的相同-因为您希望扩展或更改基类的行为。 UIControl is kind of like UIViewController. UIControl类似于UIViewController。 You never create instances of UIViewController. 您永远不会创建UIViewController的实例。 You always create subclasses to make specific view controllers for your app. 您总是创建子类来为您的应用创建特定的视图控制器。 UIControl is similar. UIControl与之类似。 It gives you basic UI control functionality but not for any specific control. 它提供了基本的UI控件功能,但没有提供任何特定的控件。 You would subclass UIControl to create your own, unique UI control that isn't provided by the SDK. 您可以将UIControl子类化以创建您自己的,独特的UI控件,而该控件不是SDK所提供的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM