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
94
votes
11 answers

How to change height of grouped UITableView header?

I know how to change the height of the section headers in the table view. But I am unable to find any solution to change the default spacing before the first section. Right now I have this code: - (CGFloat)tableView:(UITableView *)tableView…
circuitlego
  • 3,469
  • 5
  • 22
  • 22
93
votes
3 answers

Advantages, problems, examples of adding another UIWindow to an iOS app?

Recently I've been wondering about the fact that that an iOS app only has one UIWindow. It does not seem to be an issue to create another UIWindow and place it on screen. My question is kind of vague, but I'm interested in: What could I potentially…
Krumelur
  • 32,180
  • 27
  • 124
  • 263
93
votes
16 answers

How to Navigate from one View Controller to another using Swift

I'd like to navigate from one view controller to another. How can I convert the following Objective-C code into Swift? UIViewController *viewController = [[self storyboard]…
sathish
  • 1,180
  • 1
  • 9
  • 9
90
votes
4 answers

How to do a native "Pulse effect" animation on a UIButton - iOS

I would like to have some kind of pulse animation (infinite loop "scale in - scale out") on a UIButton so it gets users' attention immediately. I saw this link How to create a pulse effect using -webkit-animation - outward rings but I was wondering…
Johann
  • 12,158
  • 11
  • 62
  • 89
90
votes
15 answers

How to Make the scroll of a TableView inside ScrollView behave naturally

I need to do this app that has a weird configuration. As shown in the next image, the main view is a UIScrollView. Then inside it should have a UIPageView, and each page of the PageView should have a UITableView. I've done all this so far. But my…
89
votes
11 answers

Draw dotted (not dashed!) line, with IBDesignable in 2017

It's easy to draw a dashed line with UIKit. So: CGFloat dashes[] = {4, 2}; [path setLineDash:dashes count:2 phase:0]; [path stroke]; Is there any way way to draw a genuine dotted line?
Fattie
  • 27,874
  • 70
  • 431
  • 719
89
votes
5 answers

What is the best way to remove all subviews from you self.view?

I was thinking maybe something like this might work: for (UIView* b in self.view.subviews) { [b removeFromSuperview]; } I want to remove every kind of subview. UIImages, Buttons, Textfields etc.
user440096
88
votes
4 answers

Difference between addSubview and insertSubview in UIView class

What is the difference between addSubview and insertSubView methods when a view is added programmatically?
Ashwani K
  • 7,880
  • 19
  • 63
  • 102
87
votes
7 answers

How to sleep for few milliseconds in swift 2.2?

please anyone tell me how to use sleep() for few milliseconds in swift 2.2? while (true){ print("sleep for 0.002 seconds.") sleep(0.002) // not working } but while (true){ print("sleep for 2 seconds.") sleep(2) // working } it is…
sulabh qg
  • 1,155
  • 2
  • 12
  • 20
86
votes
8 answers

UISegmentedControl change number of segments programmatically

Is there a way to change the number of segments programmatically?
Beppino66
  • 1,709
  • 2
  • 13
  • 15
85
votes
10 answers

Is there any ready-made calendar control for iPhone apps?

I am building an applicaiton for the iPhone that will display upcoming and past events. I settled for a list view, but then I realized that a calendar (just like the one displayed in the "month" view in the built-in Calendar application) would be a…
chesterbr
  • 2,940
  • 3
  • 29
  • 26
85
votes
9 answers

How to add a 'Done' button to numpad keyboard in iOS

So, the numpad keyboard doesn't come with a 'Done' or 'Next' button by default so I'd like to add one. In iOS 6 and below there were some tricks to add a button to the keyboard but they don't seem to be working in iOS 7. First I subscribe to the…
George McKibbin
  • 1,291
  • 1
  • 11
  • 16
84
votes
8 answers

How do you draw a line programmatically from a view controller?

I have a UIViewController. How do I draw a line in one of its programmatically created views?
mkc842
  • 2,361
  • 2
  • 26
  • 38
83
votes
8 answers

How to delete a user default value in NSUserDefaults?

I.e., my app sets some standard default values at the beginning. Then those values may get overridden by the user. And when the user messes things up, I want to set those settings back to my app default values. As I understand it, the app defaults…
HelloMoon
82
votes
2 answers

UITextView content inset

I have encountered something a bit strange with contentInsets I have a UITextView in my storyboard with a contentInset of 50 left, as I'm trying to add some padding to my uitextview However, a scrollbar appears on the bottom of the uitextview, as…
H Bellamy
  • 22,405
  • 23
  • 76
  • 114