iOS Tutorial

How To Enable Text Input In Swift UITextField & UITextView When Run App In iOS Simulator

In my iOS app, I add a UITextField in the Main.storyboard file. When I run the app in the iOS simulator, I find I can not input text in the UITextField use my Mac book pro hardware keyboard. And I find the soft keyboard does not prompt in the iOS simulator when I focus on …

How To Enable Text Input In Swift UITextField & UITextView When Run App In iOS Simulator Read More »

How To Fix Swift Error Unable To Activate Constraint With Anchors Because They Have No Common Ancestor & LayoutConstraints Unable To Simultaneously Satisfy Constraints

When i develop an iOS app, i add a UITextField in the app UI programmatically. And i also add some constraints to the UITextField object in swift source code to make it auto layout. But when i run the app, it throws an exception with error message ‘NSGenericException’, reason: ‘Unable to activate constraint with anchors, …

How To Fix Swift Error Unable To Activate Constraint With Anchors Because They Have No Common Ancestor & LayoutConstraints Unable To Simultaneously Satisfy Constraints Read More »

How To Display Or Hide View Controller Scene ( Document Outline ) Panel In Xcode Project

When I develop an iOS app with Xcode, I design the user interface by edit the Main.storyboard file. But when I click the Main.storyboard file to edit it, I can not find the View Controller Scene (Document Outline) panel at the center editor’s left side. This confused me a lot. Finally, I find the solution …

How To Display Or Hide View Controller Scene ( Document Outline ) Panel In Xcode Project Read More »

How To Use iOS UISegmentedControl In Swift Programmatically Example

This example will tell you how to add and use the iOS UISegmentedControl object both in the Main.storyboard visually and programmatically in swift source code. There are two UISegmentedControl objects on the app screen. The above one is added to the Main.storyboard visually, when click it’s item, it will display the item title or image …

How To Use iOS UISegmentedControl In Swift Programmatically Example Read More »

How To Use iOS UISwitch In Interface Builder And Programmatically In Swift Example

This example will tell you how to create and use the UISwitch component both in Xcode interface builder and swift source code. It will add one label, one UISwitch to the Main.storyboard. And the other UISwitch component is created and used in ViewController.swift file uses source code programmatically. Let us first look at the example …

How To Use iOS UISwitch In Interface Builder And Programmatically In Swift Example Read More »

How To Change UITextField Keyboard Type And Hide Keyboard Automatically When Press Return Key

All the swift interactive UI components ( UITextField, UITextView, etc ) can prompt the keyboard automatically when you focus on it. And you can change the keyboard type both in the interface builder Attributes Inspector panel and programmatically. This article will tell you how to set the keyboard type and how to hide the keyboard …

How To Change UITextField Keyboard Type And Hide Keyboard Automatically When Press Return Key Read More »

How To Use UITextField And UITextView In Swift Programmatically Example

We have introduced how to use UITextField and UITextView in the article iOS UITextField And UITextView Swift Example. In that article, we use interface builder and storyboard to create the user interface, assign delegate protocol to the view controller, implement delegate methods to respond to user action ( for example: begin editing a text field, …

How To Use UITextField And UITextView In Swift Programmatically Example Read More »

Swift Xcode 11 iOS 13 Scene Delegate Life Cycle Example

When you create an iOS 13 project in Xcode 11 use a single view app template, you will find Xcode 11 add a SceneDelegate.swift file automatically beside the AppDelegate.swift file. It defines a SceneDelegate class in the SceneDelegate.swift file, and this class takes over some UI life cycle functions which are implemented by AppDelegate class …

Swift Xcode 11 iOS 13 Scene Delegate Life Cycle Example Read More »

Clicky