iOS Tutorial

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 »

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 subclass 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 Use

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

How To Fix Error Could Not Find A Storyboard Named ‘Main’ In Bundle NSBundle In Xcode 11.0

When I follow the article How To Create A Swift App Without Storyboard to learn how to create an iOS app without using the storyboard, after I remove the Main.storyboard file and run it. I meet an error message like this Could not find a storyboard named ‘Main’ in bundle NSBundle.

How To Fix Error Could Not Find A Storyboard Named ‘Main’ In Bundle NSBundle In Xcode 11.0 Read More »

How To Set Application Root View Controller Programmatically In Xcode 11

When using Xcode 11 to create a new iOS project, if you still create the root view controller in AppDelegate class’s – func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool function as usual, you will find there is a compile time error which said Value of type ‘AppDelegate’ has no member ‘window’. And

How To Set Application Root View Controller Programmatically In Xcode 11 Read More »