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
80
votes
5 answers

How to draw a smooth circle with CAShapeLayer and UIBezierPath?

I am attempting to draw a stroked circle by using a CAShapeLayer and setting a circular path on it. However, this method is consistently less accurate when rendered to the screen than using borderRadius or drawing the path in a CGContextRef…
bcherry
  • 7,150
  • 2
  • 28
  • 37
80
votes
12 answers

Programmatically Select all text in UITextField

How can I programmatically select all text in UITextField?
Mirko
  • 2,231
  • 2
  • 21
  • 17
79
votes
1 answer

What properties can I set via an UIAppearance proxy?

What properties can I set via an UIAppearance proxy? Apple's UIKit documentation does not list them. Is there a list of these properties?
Emile Cormier
  • 28,391
  • 15
  • 94
  • 122
77
votes
7 answers

Adding padding to an UIView

I'm looking for a way to add a padding property to an UIView. Ideally, I would like to avoid subclassing and putting it in a category. The usage would be something like: myview.padding = UIEdgeInsetsMake(10, 10, 10, 10); And maybe have a paddingBox…
Meda
  • 2,776
  • 4
  • 20
  • 31
76
votes
7 answers

How to ignore touch events and pass them to another subview's UIControl objects?

I have a custom UIViewController whose UIView takes up a corner of the screen, but most of it is transparent except for the parts of it that have some buttons and stuff on it. Due to the layout of the objects on that view, the view's frame can cover…
Chris C
  • 3,221
  • 1
  • 27
  • 31
76
votes
9 answers

How to scale down a UIImage and make it crispy / sharp at the same time instead of blurry?

I need to scale down an image, but in a sharp way. In Photoshop for example there are the image size reduction options "Bicubic Smoother" (blurry) and "Bicubic Sharper". Is this image downscaling algorithm open sourced or documented somewhere or…
Proud Member
  • 40,078
  • 47
  • 146
  • 231
74
votes
10 answers

UIButton Text Margin / Padding

I have the following layout, and I'm trying to add a padding to the left and right.. The controls are a disabled UIButton. My code for creating a button is this: UIButton *buttonTime = [[UIButton alloc] initWithFrame:CGRectMake(90, 10, 50, 20)];…
PartySoft
  • 2,749
  • 7
  • 39
  • 55
73
votes
8 answers

UITableView Footer, Stop from floating over content

I would like to make my UITableView Footer stop floating over my content, as is the default activity. I want my footer to be.. well.. a footer. Always the last view to be displayed at the end of my tableview. :) Same thing with the header too…
Jason
  • 2,445
  • 3
  • 17
  • 17
72
votes
7 answers

iOS 8 - Screen blank after dismissing view controller with custom presentation

When dismissing various view controllers using UIModalPresentationCustom, the screen turns black after the view controller is dismissed, as if all the view controllers had been removed from the view hierarchy. The transitioning delegate is set…
jaggedcow
  • 1,405
  • 1
  • 12
  • 23
72
votes
5 answers

Pull-to-refresh in UICollectionViewController

I want to implement pull-down-to-refresh in a UICollectionViewController under iOS 6. This was easy to achieve with a UITableViewController, like so: UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; [refreshControl addTarget:self…
mjh
  • 3,508
  • 3
  • 19
  • 19
72
votes
3 answers

How is the relation between UIView's clipsToBounds and CALayer's masksToBounds?

A UIView has a CALayer. That's pretty sure. But both seem to provide something that means the same thing. If I'd set clipsToBounds=YES, would this also set the layer's masksToBounds=YES? Why different names? Anyone knows?
Thanks
  • 40,109
  • 71
  • 208
  • 322
71
votes
17 answers

Swift Custom NavBar Back Button Image and Text

I need to customise the look of a back button in a Swift project. Here's what I have: Here's what I want: I've tried creating my own UIBarButtonItem but I can't figure out how to get the image to be beside the text, rather than as a background or…
Conor
  • 1,007
  • 1
  • 10
  • 16
68
votes
6 answers

How do I give a UITextView focus programmatically?

So I want to bring in a modal view controller that has a UITextView in it and I want the keyboard to automatically popup and the UITextView have focus. I found a way to accomplish this by doing the following: textView.editable =…
Meroon
  • 3,458
  • 4
  • 25
  • 29
68
votes
5 answers

UIButton title alignment and multiline support

How do I set the title of a UIButton to be left-aligned, and how can I show multiple lines of text in a UIButton?
Raju
  • 3,459
  • 12
  • 37
  • 30
68
votes
9 answers

Clearing UIWebview cache

I have used UIWebview to load a web page using loadRequest: method, when I leave that scene I call [self.webView stopLoading]; and release the webView. In activity monitor on first launch i have seen that the real memory increased by 4MB, and on…
Chandan Shetty SP
  • 5,087
  • 6
  • 42
  • 63