Choosing the right view between UILabel and UITextView to display text inside your iOS, iPadOS and macOS Catalyst App

The dilemma of choosing between UILabel and UITextView starts when you want to display text in your Apple iOS, iPadOS or macOS Catalyst App.

I have even gone through this process of choosing UILabel or UITextView to display text on my app.

So I have made a small numbered list to help you out to choose the right option…

Choose UILable to display text:

  1. If the text word count is small in number
  2. If Top Aligning text to the top border is not the requirement
  3. UILable is not tappable or interactive or selectable to the user’s input
  4. if you want to automatically adjust the font size and fit text to the UILabel bounding box layout

Here is Sample Code for UILabel:

(more…)

Continue Reading Post

How programmatically add Fab (Floating Action Button) Button to iPhone, iPad and Mac (Catalyst) App

When Google released Material Design Guidelines they introduced many new design elements and one of them was Fab Button i.e. Floating Action Button

Normally we see the Fab button in Android Mobile Apps but a lot of Apple iPhone, iPad and Mac App Developers has started using the Fab button in their design.

Here we will see how to add the Fab button programmatically in your iOS, iPadOS and macOS app on any view including UICollectionView or UITableView.

Step 01: First declare the UIButton variable in your View Controller

var fabButton = UIButton()

Step 02: Add this code to viewDidLoad()

(more…)

Continue Reading Post

Here is how to set UINavigation Bar Large Title Text Colour (Foreground Colour) in iOS 11, 12, 13 and above

Here is how to set UINavigation Bar Large Title Text Colour (Foreground Colour) in iOS 11, 12, 13 and above,

 
Declare Navigation Bar Title Text & Large Title Settings like this in your View Controller’s ViewDidLoad() Method:

 

self.navigationItem.title = "Home"
self.navigationController?.navigationBar.prefersLargeTitles = true
self.navigationController?.navigationItem.largeTitleDisplayMode = .automatic

 
Now write below line inside ViewDidLoad() to get Large Title Foreground colour as White Colour like this:

(more…)

Continue Reading Post

Here is how to do UIImageView Image Inset in Apple iOS App using Xcode

Here is example if you want to inset UIImageView so that image does not fit edge to edge of the UIImageView

 
Note: Use of latest version of Xcode & Latest version of Swift Programming Language is preferred.

 
Here is step by step procedure to achieve designed result:

 
Step 01: Create Apple iOS Project in Xcode. Add UIImageView to View Controller in Storyboard.

 
Step 02: Now Connect that UIImageView to View Controller Swift File. It will look something like this.

 

@IBOutlet weak var imageView: UIImageView!

 
Step 03: Now add following code in ViewDidLoad Function of your View Controller File.

(more…)

Continue Reading Post

Here is how to animate Tab bar tab switch with a CrossDissolve slide transition in UITabBarViewController!

While searching for answer on web for how to give CurlUp / CrossDissolve / FlipFromRight / FlipFromLeft / CurlDown / FlipFromTop / FlipFromBottom transition effect for UITabBar Tab Switch.

 
I found out this answer but with bug or black screen when you tap on same tab twice i.e. destination and current tab is same.

 
So I solve this issue with my logic and additional if and else statement.

 
So here is final answer without any bug.

 

Step 01: Add this two classes as Super Class to your UITabBarViewController

 

UITabBarController, UITabBarControllerDelegate

 

Step 02: Now add following code to your viewDidLoad Function in your UITabBarViewController

 

self.delegate = self

(more…)

Continue Reading Post

Here is how to hide Navigation Bar on Scroll in your Apple iOS App with single line of code!

Assumption: I assume your have embedded in UINavigationBar in your Apple iOS App inside Storyboard.

 
If you want to mimic Apple Safari iOS App’s behaviour of hiding navigation bar on scroll you can do it in just single line of code without any hassle.

 
You have to add following code in your View Controller’s viewDidAppear function where you have added UINavigationBar in storyboard:

(more…)

Continue Reading Post

Here is how to programatically change UITabBar Tint Color, UITabBar Item Tint Color & also how to change UITabBar Item’s unselected icon tint color.

Assumption: I assume you have deployed UITabBarViewController in your iOS App. And now you want to change UITabBar Tint color, UITabBar Item’s Tint color and also UITabBar’s unselected icon’s tint color.

 
Do this is just simple as single line of code.

 
Below code will go to your Apple iOS app’s AppDelegate.swift file under ‘didFinishLaunchingWithOptions’ function.

 
So your code will look something like this.

(more…)

Continue Reading Post

Here is how to programmatically set icon / image for Tab Bar Item in UITabBarViewController

Assumptions: I assume you have already embedded in UITabBarViewController for your ViewController in Interface Builder. I also assume you have three tab bar items with individual view controllers and further you have created images assets with your icon images.

 
Solution is simple you have to copy following code in your current View Controller’s ViewdidLoad method.

(more…)

Continue Reading Post

How to programatically change titles of tabs in UITabBarViewController and here is how to programatically change title of individual View Controllers at Navigation Bar inside individual UITabBarViewControllers.

Let’s assume you are using Tab Bar View Controller in your Xcode Apple iOS App Project.

 
You have embedded in your view controller with UITabBarViewController.

 
Say, you are using 3 Tab Views.

 
In Swift programming Language number counting starts with 0 so you will write code like this in your respective view controller’s viewDidLoad function.

(more…)

Continue Reading Post

Here is solution if you are trying to upload your app to Apple iTunes Connect but you are stuck in “Uploading to App Store – Authenticating with iTunes Store…” Message

It’s every app developers dream time when he develops and then uploads his app to Apple App Store using Xcode.

 
At that moment of time while uploading your app if you are stuck in one place where Xcode organiser says “Uploading to App Store – Authenticating with iTunes Store” & there is no further progress.

 
Then here is how to solve this!

 
Just open Terminal App from your Applications > Utilities > Terminal.

 
Paste below code in Terminal & hit return key.

(more…)

Continue Reading Post