iOS Tutorial

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 Customize Swift Slider In iOS App Example

This example will tell you how to use swift UISlider class to create slider in iOS app. There are two sliders in this example. The above slider is added in interface builder. The below slider is added in swift source code programmatically. When you slide the slider, the related slider’s value is displayed in the …

How To Customize Swift Slider In iOS App Example Read More »

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

When i develop 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 center editor left side. This confused me a lot. Finally i find the solution to fix …

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 iOS UISegmentedControl object both in Main.storyboard visually and programmatically in swift source code. There are two UISegmentedControl object in the app screen. The above one is added in Main.storyboard visually, when click it’s item, it will display the item title or image in the above …

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 UISwitch component both in Xcode interface builder and swift source code. It will add one label, one UISwitch in Main.storyboard. And the other UISwitch component is created and used in ViewController.swift file use source code programmatically. Let us first look at the example demo as …

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 component ( UITextField, UITextView etc ) can prompt keyboard automatically when you move focus on it. And you can change the keyboard type both in interface builder Attributes Inspector panel and programmatically. This article will tell you how to set the keyboard type and how to hide the keyboard when …

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 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 response user action ( for example : begin editing text field, etc.). In …

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 single view app template, you will find Xcode 11 add a SceneDelegate.swift file automatically besides the AppDelegate.swift file. It define a SceneDelegate class in the SceneDelegate.swift file, and this class takes over some UI life cycle functions which is implemented by AppDelegate class before. …

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

How To Fix Error Use Of Unresolved Identifier ‘RootViewController’ In Xcode Swift Project

When i develop an iOS project in Xcode, i create a custom class RootViewController in RootViewController.swift file, this class is a sub class of UIViewController. But during the development process, when i use this custom class to create an object in another swift file ( for example SceneDelegate.swift ), i meet an error which said …

How To Fix Error Use Of Unresolved Identifier ‘RootViewController’ In Xcode Swift Project Read More »