Understanding the Class Hierarchy of UIButton in UIKit

The Fundamentals

Steven Curtis
4 min readNov 25, 2024
Photo by Bernd 📷 Dittrich on Unsplash

Understanding the class hierarchy allows unlocking of the true power of UIKit.

The UIButton class is part of the extensive hierarchy that extends to the root of all objects in Objective-C: NSObject. Each superclass in this chain contributes unique capabilities to UIButton, creating a feature-rich and versatile UI component.

So let us take a deep-dive into the class hierarchy.

The Simple Mode

A most basic view of the class hierarchy looks something like this:

UIButton> UIControl> UIView> UIResponder> NSObject

Which needs more analysis. So let us step forwards, into the deep-dive.

The Deep-Dive

UIButton

Purpose
UIButton is the UIKit class used to create buttons in an iOS interface. Buttons are interactive elements that can respond to taps, hold states (like highlighted or selected), and trigger actions.

Core Features
UIButton enables text and image customization, background color, tint color, content insets, and different appearance states (like normal, highlighted, selected, and disabled).

--

--

Responses (1)