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
285
votes
42 answers

How to find topmost view controller on iOS

I've run into a couple of cases now where it would be convenient to be able to find the "topmost" view controller (the one responsible for the current view), but haven't found a way to do it. Basically the challenge is this: Given that one is…
Hot Licks
  • 47,103
  • 17
  • 93
  • 151
281
votes
25 answers

preferredStatusBarStyle isn't called

I followed this thread to override -preferredStatusBarStyle, but it isn't called. Are there any options that I can change to enable it? (I'm using XIBs in my project.)
trgoofi
  • 3,091
  • 3
  • 16
  • 11
280
votes
21 answers

Aligning text and image on UIButton with imageEdgeInsets and titleEdgeInsets

Historic question. Note that 15 years later, .padding is the space between the image and label. Original question: I would like to place an icon left of the two lines of text such that there's about 2-3 pixels of space between the image and the…
Justin Galzic
  • 3,951
  • 6
  • 28
  • 39
254
votes
11 answers

CGRectMake, CGPointMake, CGSizeMake, CGRectZero, CGPointZero is unavailable in Swift

After converting code to latest swift 3.0 I am shown this error. Also tell me solution for CGSize = CGSizeMake(0,0) static var frameAtStartOfPan: CGRect = CGRectZero static var startPointOfPan: CGPoint = CGPointZero Which is also unavailable.
niravdesai21
  • 4,818
  • 3
  • 22
  • 33
251
votes
28 answers

How to set back button text in iOS navigation controller?

How do you remove the back button text. Current back button: < Back Desired back button: < AnythingElse None of these have worked: self.navigationItem.backBarButtonItem?.title = "Back" self.backItem?.title =…
Onichan
  • 4,476
  • 6
  • 31
  • 60
239
votes
24 answers

How to stop unwanted UIButton animation on title change?

In iOS 7 my UIButton titles are animating in and out at the wrong time - late. This problem does not appear on iOS 6. I'm just using: [self setTitle:text forState:UIControlStateNormal]; I would prefer this happens instantly and without a blank…
exsulto
  • 2,475
  • 2
  • 15
  • 10
227
votes
9 answers

Is there a way to remove the separator line from a UITableView?

I'm looking for a way to completely remove the separator line in a UITableView when in the plain mode. This is done automatically in grouped, but this also changes the dimensions of the table in a way that is hard to measure. I have set the…
Tricky
  • 7,025
  • 5
  • 33
  • 43
218
votes
7 answers

Disable the interactive dismissal of presented view controller

iOS 13 introduces a new design of modalPresentationStyle .pageSheet (and its sibling .formSheet) for modally presented view controllers… …and we can dismiss these sheets by sliding the presented view controller down (interactive dismissal).…
Jakub Truhlář
  • 20,070
  • 9
  • 74
  • 84
216
votes
18 answers

How to change Navigation Bar color in iOS 7?

How do I change the Navigation Bar color in iOS 7? Basically I want to achieve something like the Twitter Nav Bar (updated Twitter for iOS7 that is). I embedded-in a nav bar atop a view controller. All I want is to change the nav bar color to light…
Patricio Guerra
  • 2,277
  • 2
  • 13
  • 11
214
votes
31 answers

Is it possible to disable floating headers in UITableView with UITableViewStylePlain?

I'm using a UITableView to layout content 'pages'. I'm using the headers of the table view to layout certain images etc. and I'd prefer it if they didn't float but stayed static as they do when the style is set to UITableViewStyleGrouped. Other then…
Tricky
  • 7,025
  • 5
  • 33
  • 43
213
votes
6 answers

How to use UIVisualEffectView to Blur Image?

Could someone give a small example of applying the blur to an image? I've been trying to figure out the code for a while now :( still new at obj c! The UIVisualEffectView provides a simple abstraction over complex visual effects. Depending on…
cNoob
  • 2,133
  • 3
  • 13
  • 4
206
votes
22 answers

Multiline label in UIStackView

When putting multiline label (with linebreak set to Word Wrap) into a stack view, the label immediately loses the linebreak and displays the label text in one line instead. Why is this happening and how does one preserve multiline label within a…
Boon
  • 40,656
  • 60
  • 209
  • 315
198
votes
11 answers

Adding the "Clear" Button to an iPhone UITextField

How do you add that little "X" button on the right side of a UITextField that clears the text? I can't find an attribute for adding this sub-control in Interface Builder in the iPhone OS 2.2 SDK. Note: In Xcode 4.x and later (iPhone 3.0 SDK and…
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
197
votes
15 answers

UICollectionView spacing margins

I have a UICollectionView which shows photos. I have created the collectionview using UICollectionViewFlowLayout. It works good but I would like to have spacing on margins. Is it possible to do that using UICollectionViewFlowLayout or must I…
Mert
  • 6,025
  • 3
  • 21
  • 33
196
votes
36 answers

UIButton: Making the hit area larger than the default hit area

I have a question dealing with UIButton and its hit area. I am using the Info Dark button in interface builder, but I am finding that the hit area is not large enough for some people's fingers. Is there a way to increase the hit area of a button…
Kevin Bomberry
  • 3,122
  • 4
  • 22
  • 18