iOS Tutorial

How To Add iOS App Icon, Image, Color Set To Xcode Project Assets Catalog Correctly

Xcode project organizes project resource files use Asset Catalog. Each asset catalog can contain multiple asset sets such as app icon set, image set, color set, etc. When you create an Xcode project use one project template such as Single View App, it will create a default asset catalog file Assets.xcassets in the project files […]

How To Add iOS App Icon, Image, Color Set To Xcode Project Assets Catalog Correctly Read More »

How To Change Swift Constraints To Make Autolayout Programmatically

In the previous article, we have learned how to change swift constraints use the auto-layout toolbar visually ( How To Add Constraints In Xcode 10 To Implement Auto Layout ). In this article, I will show you an example of how to use class UIKit.NSLayoutConstraint, UIKit.NSLayoutAnchor and Visual Format Language to add constraints to the

How To Change Swift Constraints To Make Autolayout Programmatically Read More »

How To Add Constraints In Xcode 10 To Implement Auto Layout

When you develop an iOS app use swift, you can make the UI components fixed size. But iOS devices have different screen sizes, so the fixed size UI components will render differently on different iOS devices. Even when you change the same iOS device’s orientation from portrait to landscape, the fixed size UI design will

How To Add Constraints In Xcode 10 To Implement Auto Layout Read More »

How To Fix Image Not Showing Error For Swift Button

When you use UIKit.UIButton class’s setImage method to set swift button’s icon image, if the image is not icon format, it will display a purely blue color rectangle instead of the image. You can fix this error by converting the image to an icon format image. But you can also fix this error by setting

How To Fix Image Not Showing Error For Swift Button Read More »

How To Use One IBAction For Multiple Buttons In Swift

We have learned how to add a button click event process function in the article iOS Add Click Event To UIButton Swift Example. In that article, if you want to process multiple button click events, you should create multiple IBAction functions to process. But sometimes, for code simplicity, you need to use only one IBAction

How To Use One IBAction For Multiple Buttons In Swift Read More »

How To Create Different Type Button Programmatically In Swift

UIKit.UIButton class is used to create a button in the iOS swift app programmatically. When you use this class to create a button object, you should provide a type parameter to UIButton class’s initializer method to tell swift which kind of button that you want to create. We only create a default system button in

How To Create Different Type Button Programmatically In Swift Read More »

How To Customize Swift Label Text Font And Set Text Shadow

Swift UIKit.UIFont class is used to specify the label text font. You can use a system built-in text font, or you can customize the text font by providing the font name and font size. This example will tell you how to specify system font or provide customize text font to swift label component. It will

How To Customize Swift Label Text Font And Set Text Shadow Read More »

How To Create, Align And Wrap Label Text Programmatically In Swift iOS App

UIKit.UILabel class is used to create a label in iOS swift source code programmatically. You can change label text, label text color, label background color, label border width, label border color by setting it’s properties. You can also change the label text alignment by change the UILabel object’s textAlignment property value t0 NSTextAlignment.left, NSTextAlignment.center or NSTextAlignment.right.

How To Create, Align And Wrap Label Text Programmatically In Swift iOS App Read More »