- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 201 Articles for IOS

Updated on 11-Sep-2019 08:40:24
In this post we will be seeing how to make phone in iOS programmatically.So let’s get started.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “MakeCall”Step 2 − Open Main.storyboard and add one text field and one button as shown belowStep 3 − Create @IBOutlet for the text field, name it phoneNumberTextfield.Step 4 − Create @IBAction method callButtonClicked for call buttonStep 5 − To make a call we can use iOS openURL. In callButtonClicked add following linesif let url = URL(string: "tel://\(phoneNumberTextfield.text!)"), UIApplication.shared.canOpenURL(url) { UIApplication.shared.open(url, options: [:], completionHandler: nil)Step 6 − Run the ... Read More 
Updated on 11-Sep-2019 08:35:25
In this post we will learn how to fetch and show the iOS build and version numberStep 1 − Open Xcode → New Project → Single View Application → Let’s name it “ShowBuildAndVersion”Step 2 − Open Main.storyboard and add two labels as shown below.Step 3 − Attach @IBOutLets for the two labels@IBOutlet weak var buildLabel: UILabel! @IBOutlet weak var versionLabel: UILabel!Step 4 − Change the build and version from project settings.Step 5 − In viewDidLoad of ViewController get the build and version number for infoDictionary of main bundle. Show it on the corresponding labels.override func viewDidLoad() { super.viewDidLoad() ... Read More 
Updated on 11-Sep-2019 08:30:35
In this post we will be seeing how to get the touch position on device using Swift.So let’s get started.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “TouchMe”Step 2 − Open Main.storyboard and add one label as shown below. On this label we will show the touch position.Step 3 − Create @IBOutlet for the label, name it touchPositionLabel.Step 4 − We will be overriding the touchesBegan method in ViewController to get the touch position in the view. Override the method as shown belowoverride func touchesBegan(_ touches: Set, with event: UIEvent?) { ... Read More 
Updated on 11-Sep-2019 08:25:16
In this post we will be seeing how to get the battery state in iOS.So let’s get started.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “BatteryState”Step 2 − Open Main.storyboard and add two label as shown below. On this label we will show battery status.Step 3 − Enable the battery state monitoring, using the following code. You can put this code in viewDidLoad of ViewControllerUIDevice.current.isBatteryMonitoringEnabled = trueStep 4 − Declare a variable to hold the battery state. We will name this variable batteryState. From this variable we are returning UIDevice.current.batteryState, that would ... Read More 
Updated on 11-Sep-2019 08:18:31
In this post we will learn how to calculate the distance between two geo locations.We will show the distance between two points on a label.To do so follow the steps belowStep 1 − Open Xcode → New Project → Single View Application → Let’s name it “FindDistance”Step 2 − Open Main.storyboard and add two labels as shown below.Step 3 − Attach one @IBOutlet for the bottom label. Name it distanceLabelStep 4 − Import CoreLocation framework in ViewControllerStep 5 − Add two points between which we want to find the distance as variablesvar firsLocation = CLLocation(latitude:34.54545, longitude:56.64646) var secondLocation = CLLocation(latitude: ... Read More 
Updated on 11-Sep-2019 08:13:30
Disabling scrolling in WebView in iOS is very simple.The ‘scrollView’ property of the WebView is exposed by iOS.You will just need to disable the scrolling of the corresponding scrollView using below code.webView.scrollView.isScrollEnabled = falseThe above code will disable the scrolling on WebView.If you were just looking to disable scrolling in web view above code would do that. If you want to know from scratch how to load WebView and disable scrolling. Follow along.Let’s create a sample project in XCode and learn the WebView loadingStep 1 − Open Xcode → New Project → Single View Application → Let’s name it “WebViewScrollDisabling”Step ... Read More 
Updated on 03-Jul-2020 12:32:40
In this post we will be seeing how to customise iOS button.So let’s get started.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “CustomiseButton”Step 2− Open Main.storyboard and add a button as shown below. We will customize this buttonThere are two ways to customise this buttonUsing StoryboardStep 1 − Click on the buttonStep 2 − In the right panel, in the attribute inspector you can change the text color, text and background color of the button as shown belowRun the project you will see the customise button as belowNow we will see the ... Read More 
Updated on 11-Sep-2019 07:57:25
It’s very easy to check whether text field is empty or not in Swift.You will first need to check whether text is available or not in text field i.e. it’s not nil, then you will need to check if its present then its empty or not. Assuming myTextField is your text field variable name, you can do the followingif let text = myTextField.text, text.isEmpty { // myTextField is not empty here } else { // myTextField is Empty }Above code will check if textField is empty or not.If you want to look at how the text field can ... Read More 
Updated on 11-Sep-2019 07:52:04
In this post we will learn how to add top and bottom border to view.In this example we will take as sample view and add borders to it.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “AddBorderTopAndBottom”Step 2 − Open Main.storyboard add a UIView to it as shown below.Step 3 − Add one @IBOutlet for the view, name it centerView.Step 4 − We will write separate method to add borders to this view. To add borders to this view we will create two layers with desired thickness. We will set the frame of ... Read More 
Updated on 11-Sep-2019 07:47:17
In this post we will learn how to change the background color of view with animation.In this example we will change background color of view on click of a button. On clicking the button the background color will change to red, then on next click it would change to blue, on next click to red again.Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “ChangeBGColor”Step 2 − Open Main.storyboard add a button as shown belowStep 3 − Add one @IBAction for touchUpInside of ‘Change Background’ button. Name the function as changeBackgroundClicked.Step 4 − ... Read More Advertisements