UIButton

In this Swift tutorial, you will learn how to create a UIBarButtonItem with an image programmatically. It will be a short tutorial, but it will cover the following code snippets in Swift: Creating a UIBarButtonItem with an image. Adding the UIBarButtonItem to the navigation bar. Handling the tap event of the UIBarButtonItem. If you are new to UIBarButtonItem, please check…

Read More UIBarButtonItem with Image Example in Swift

In this Swift tutorial, you will learn how to create UIBarButtonItem programmatically without using the storyboard or the interface builder. I will cover topics such as: Create UIBarButtonItem programmatically. How to set the right sidebar button item rightBarButtonItem. How to set the left sidebar button item leftBarButtonItem. How to set target action on UIBarButtonItem to…

Read More Create UIBarButtonItem Programmatically

In this Swift code example, you will learn how to create a UIButton in Swift programmatically without using the storyboard or the interface builder. This is going to be a short tutorial with a very simple code example, but it will contain a lot of useful details like: Create UIButton programmatically in Swift, Position UIButton…

Read More Create UIButton Programmatically in Swift

In this Swift code example, you will learn how to disable UIButton. The quickest way to disable the button in Swift is to simply set the button’s isEnabled property to false. For example button.isEnabled = false.  Below is a complete code example in Swift that demonstrates how to: Create new UIButton, Position button within a view,…

Read More Disable UIButton Example in Swift

In this XCTest tutorial, you will learn how to write a unit test that will test if UIButton is connected to @IBOutlet and has @IBAction assigned. For this tutorial, I will create a Single View application project. I will use the default View Controller that XCode creates for all new projects and I will position…

Read More XCTest. Test if UIButton is Connected And Has Action

In this short tutorial, you will learn how to set a different font on UIButton in Swift programmatically. There are lots of different customization you can with UIButton. For example, you might be also interested to learn how to create UIButton and change its style, background color, tint color and make it call a function…

Read More Set UIButton Font Programmatically in Swift

In this tutorial, you will learn how to create UIButton programmatically. You will also learn how to do the basic customization of UIButton like setting button tint color, background color and making your button call a function when tapped. Create UIButton A new UIButton can be created of different types: ButtonType.custom, ButtonType.system, ButtonType.detailDisclosure, ButtonType.infoLight, ButtonType.infoDark,…

Read More Create UIButton in Swift Programmatically