Sadiqaadil

Sadiqaadil

13 Articles Published

Articles by Sadiqaadil

Page 2 of 2

How to check if a text field is empty or not in swift?

Sadiqaadil
Sadiqaadil
Updated on 11-Sep-2019 4K+ Views

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

How to add a border to the top and bottom of an iOS View?

Sadiqaadil
Sadiqaadil
Updated on 11-Sep-2019 5K+ Views

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

How do you animate the change of background color of a view on iOS?

Sadiqaadil
Sadiqaadil
Updated on 11-Sep-2019 2K+ Views

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
Showing 11–13 of 13 articles
« Prev 1 2 Next »
Advertisements