Friday, May 4, 2018

Swift UIButton Programmatically with different styles

There is always two ways to use the elements in IOS Development. One is through storyboard and another is programmatically. The first method is simple you just have to drag particular element from the element area and drop it where ever you want and then give that element some constraints to adjust it in different screen sizes. The main drawback of first method is when there is new apple device with different screen size released you have to re-constraints all elements manually every time. To overcome this choose second method that is through programmatically.

Here we focus on the second Method of using UIButton element in swift i.e. programmatically.


The simple code for using UIButton Programmatically:

let button = UIButton(frame:

No comments:

Post a Comment