
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 33676 Articles for Programming

4K+ Views
In Swift, we have a dismiss method of the class UIViewController that can be used to dismiss a ViewController in Swift. In this method, a Boolean value is used as an argument. There is an argument in this argument that asks whether the dismissed controller should be animated. By default, this is true in this method. The following example shows how to dismiss a UIViewController screen in Swift. First view controller setup In this step, we will set up the first view controller to present the second view controller. We will add a button to the first view controller, which ... Read More

2K+ Views
In the iOS applications, the UIImageView class does not provide in-build support to make it clickable like other components e.g. UIButton. In order to make UIImageView clickable, you can add a UITapGestureRecognizer to the image view. Remember that, by default, UIImageView does not take any interaction from the user. To make it interactable, set true to the isUserInteractionEnabled property. In this article, you will learn how you can add a tag gesture to the image view in Swift. To add a tap gesture, we will follow these steps − Step 1 - Create an Image View let profileImageView = ... Read More

10K+ Views
In iOS, there is a class CAGradientLayer to apply gradient colors to views. In this article, we will look at how you can use the CAGradientLayer class to apply gradients to the background of a view in iOS. The CAGradientLayer class provides different properties like colors, locations, points, frame, etc. We will use them to apply the gradient to a view. In last, we will use the insertSublayer method to add the gradient layer to the super view. To apply a gradient to the background view of an iOS Swift app, you can follow these steps − Step 1 - ... Read More

2K+ Views
Generally, we use UIAlertController to show an alert with a dismiss action button. But UIAlertController provides you with more flexibility to add UITextFields to the alert. Let's see some examples of different use cases. When you add a text field to the UIAlertController, you can take the input value entered in the text field. It is also possible to add multiple text fields. In this example, we will use the following steps to get input values from the text field in iOS. Basic Setup In this step, you will add a button object to the controller's view to present the ... Read More

2K+ Views
In real iOS applications, most of the time you deal with UITextFields for taking various inputs. In order to make the text fields visible while editing, you can manage the constraints by updating them. To manage the constraints, you have to add observers for keyboard showing and hiding. In this article, we will move the text field when the keyboard appears with the following steps. Step 1 - Basic setup In this step, we will do some basic setup by adding a text field to enter the email address. We will add the text field at the bottom of the ... Read More

2K+ Views
By default, a view controller shows the text "Back" with an arrow on the back button in iOS. But you can set a custom title and icon for the back button item. Let's see an example of how to set custom back button text in Swift. In this example, we will set up two different view controllers to see the default behavior of the back button and how to set the custom back button text. First View Controller Setup In this step, we will set up the first view controller to push the second view controller. Here is the code ... Read More

860 Views
In iOS applications, you will often need to customize the button according to your requirements. When you add a button to the parent view, the button title is animated by default. But if you want to stop that default animation, you can use the custom button in UIKit. We will first create a situation where you can see this problem. Here is the basic setup. Initially, we will add a register button to the parent view with basic customization. We will add the constraints programmatically to the button to set the button's position. Step 1 − Create a button ... Read More

987 Views
In Haskell, we can find Sum of N Numbers by using recursion, tail-recursion and fold-recursion. In the first example we are going to use base case, (sum_n [] = 0) and recursive case, (sum_n (x:xs) = x + sum_n xs)) and in second example, we are going to use, tail-recursion. And in the third example, we are going to use (sumOfN''' xs = foldr (+) 0 xs) function. Algorithm Step 1 − The recursive sum_n function is defined as, For example 1 − sum_n [] = 0 sum_n (x:xs) = x + sum_n xs. ... Read More

624 Views
In Haskell, we can find the Product of Two Numbers by using recursion along with recursive repeated addition. In the first example we are going to use (product' x y | y == 0 = 0 | y == 1 = x | otherwise = x + product' x (y-1)) function. And in the second example, we are going to use recursive repeated addition. Algorithm Step 1 − The recursive product’ function is defined as, For example 1 and 2 − product' x y | y == 0 = 0 ... Read More

657 Views
In Haskell, we can find Sum of Digits of a Number by using recursion along with mod, div and other helper functions. getCurrentTime and NominalDiffTime function. In the first example we are going to use (sumOfDigits n | n < 10 = n | otherwise = (n `mod` 10) + sumOfDigits (n `div` 10)) function. And in the second example, we are going to use helper function. Algorithm Step 1 − The recursive sumOfDigits function is defined as, For example 1 − sumOfDigits n | n < 10 = n ... Read More