Questions tagged [uikit]

UIKit (not to be confused with the front-end framework GetUIKit) is the object-oriented framework that is responsible for most of the iOS user interface.

UIKit (not to be confused with the front-end framework ) is the object-oriented framework that is responsible for most of the user interface. UIKit is part of the umbrella framework, and it is to Cocoa Touch as AppKit is to the Cocoa framework on macOS. The classes in UIKit determine the basic structure of most iOS applications as well as the majority of distinctive user interface elements that make iOS apps easily recognizable and instantly familiar.

UIKit provides the classes and protocols that lie at the foundation of any iOS application, including:

  • UIApplication
  • UIResponder
  • UIView
  • UIWindow
  • UIControl
  • UIEvent
  • UIViewController
  • UINavigationController
  • UITabBarController
  • UISplitViewController

It also provides the user interface elements with which all iOS users are familiar:

  • UIButton
  • UITextField
  • UITextView
  • UINavigationBar
  • UIToolbar
  • UITabBar
  • UISwitch
  • UILabel
  • UIScrollView
  • UITableView
  • UITableViewCell
  • UIPickerView

These lists are not exhaustive, but only meant to give a sense of the scope of the UIKit framework. A more complete list is found in the UIKit Framework Reference.

11807 questions
196
votes
3 answers

UIView's frame, bounds, center, origin, when to use what?

UIView has the properties frame, bounds, center, and origin, and they all seem to be interrelated. Most of the time, I deal with frame when setting the position and size of a UIView. I understand that frame is using global coordinate system and…
Boon
  • 40,656
  • 60
  • 209
  • 315
188
votes
17 answers

Get UIScrollView to scroll to the top

How do I make a UIScrollView scroll to the top?
Jack Humphries
  • 13,056
  • 14
  • 84
  • 125
184
votes
19 answers

How to Rotate a UIImage 90 degrees?

I have a UIImage that is UIImageOrientationUp (portrait) that I would like to rotate counter-clockwise by 90 degrees (to landscape). I don't want to use a CGAffineTransform. I want the pixels of the UIImage to actually shift position. I am using a…
RexOnRoids
  • 14,002
  • 33
  • 96
  • 136
178
votes
11 answers

How do I inspect the view hierarchy in iOS?

Is there a GUI tool that inspects the view hierarchy of an iOS app? I'm thinking about Webkit's web inspector or similar tools. I'm looking to debug layout issues, like views having the wrong position or size, or a child not being properly contained…
Kartick Vaddadi
  • 4,818
  • 6
  • 39
  • 55
172
votes
16 answers

Achieving bright, vivid colors for an iOS 7 translucent UINavigationBar

iOS 7.1 UPDATE: Looks like the workaround for modifying the alpha channel in the UINavigationBar has been ignored in this update. Right now, the best solution seems to be to just 'deal with it' and hope that whatever color you choose can render a…
SpacePyro
  • 3,121
  • 4
  • 25
  • 30
172
votes
12 answers

How do you get an iPhone's device name

If you open Settings -> General -> About, it'll say Bob's iPhone at the top of the screen. How do you programmatically grab that name?
Brandon O'Rourke
  • 24,165
  • 16
  • 57
  • 58
171
votes
11 answers

How can I delay a method call for 1 second?

Is there an easy way delay a method call for 1 second? I have a UIImageView that reacts on a touch event. When the touch is detected, some animations happen in the app. After one second, I want to call another method. In this case, I can't use the…
Thanks
  • 40,109
  • 71
  • 208
  • 322
169
votes
18 answers

Is it possible to Turn page programmatically in UIPageViewController?

Is it possible to turn page programmatically in UIPageViewController?
RAGOpoR
  • 8,118
  • 19
  • 64
  • 97
167
votes
13 answers

Detecting sheet was dismissed on iOS 13

Before iOS 13, presented view controllers used to cover the entire screen. And, when dismissed, the parent view controller viewDidAppear function were executed. Now iOS 13 will present view controllers as a sheet as default, which means the card…
Marcos Tanaka
  • 3,112
  • 3
  • 25
  • 41
166
votes
13 answers

Using HTML and Local Images Within UIWebView

I have a UIWebView in my app which I want to use to display an image which will link to another url. I'm using to load the image. The problem is that the image doesn't load (ie. it can't be found) even though it's added as a…
Jasarien
  • 58,279
  • 31
  • 157
  • 188
164
votes
14 answers

How to disable the highlight control state of a UIButton?

I've got a UIButton that, when selected, shouldn't change state when being touched. The default behaviour is for it to be in UIControlStateHighlighted while being touched, and this is making me angry. Suggestions?
kbanman
  • 4,223
  • 6
  • 32
  • 40
157
votes
10 answers

What's the point of NSAssert, actually?

I have to ask this, because: The only thing I recognize is, that if the assertion fails, the app crashes. Is that the reason why to use NSAssert? Or what else is the benefit of it? And is it right to put an NSAssert just above any assumption I make…
HelloMoon
155
votes
7 answers

Event handling for iOS - how hitTest:withEvent: and pointInside:withEvent: are related?

While most apple documents are very well written, I think 'Event Handling Guide for iOS' is an exception. It's hard for me to clearly understand what's been described there. The document says, In hit-testing, a window calls hitTest:withEvent: on…
realstuff02
  • 1,645
  • 4
  • 12
  • 6
154
votes
9 answers

How to draw border around a UILabel?

Is there a way for UILabel to draw a border around itself? This is useful for me to debug the text placement and to see the placement and how big the label actually is.
Boon
  • 40,656
  • 60
  • 209
  • 315
152
votes
10 answers

How do I wrap text in a UITableViewCell without a custom cell

This is on iPhone 0S 2.0. Answers for 2.1 are fine too, though I am unaware of any differences regarding tables. It feels like it should be possible to get text to wrap without creating a custom cell, since a UITableViewCell contains a UILabel by…
Airsource Ltd
  • 32,379
  • 13
  • 71
  • 75