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

Here is how to change < Back button text of your Apple iOS App

While we use app development methodology like MVC (Model, View, Controller) we encounter problem while navigating from one view to another how to change text of back button which get populated automatically by Apple iOS Operating System.

 
You can use below method in viewDidLoad method of your root view:

 

navigationItem.backBarButtonItem = UIBarButtonItem(title: "Back", style: .plain, target: nil, action: nil)

 
Here is another way of doing the same which can be done in ‘prepare for segue’ method of your app:

(more…)

Continue Reading Post

Here is how you can call method or function in FirstViewController.swift from another Class called SecondViewController.swift in your iOS or macOS project within Xcode

Here is situation in your Xcode project that you want to call method from another class swift file to your original class of swift file.

 
Let’s call your original swift class file ‘FirstViewController’ which has ‘UIViewController’ as super class.

 
Second swift that you want to call function from we will assume that it has ‘SecondViewController’ as class name & it has ‘UIViewController’ as super class.

 
You have written function called ‘printSomething()’ in your ‘SecondViewController’ that would be triggered when somebody taps on button present on ‘FirstViewController’ as IBAction called ‘printThis(sender: UIButton)’

 
So you will write printThis function as follows:

(more…)

Continue Reading Post

Here is how to set a background color in UIimage using Swift Programming Language while developing app for iOS in Xcode. With addition to this here is list of UIColor predefined / preset component values in Xcode that you can use using dot operator

I will explain below how to set background color to UIimage while developing app for iOS.

 

Assumptions: I assume that you have already created Xcode project for iOS app development & you are using storyboards for developing the same. Also you have dragged UIimage View to your current ViewController.

 
Step 01: Now connect your UIimage View to your ViewController.swift file with code something like this

 

@IBOutlet weak var selectImage: UIImageView!

 
Step 02: Now in your desired function set your UIimage’s background color with following code using dot operator

(more…)

Continue Reading Post

How to Change iOS Device’s (iPhone, iPad and iPod touch) Status Bar text colour using Swift Development Language in Xcode

Let’s get started & know what is the exact requirement before we proceed for solution.

 

Assumption: I assume that you want to have Status Bar text colour to be white as your Navigation Bar background is in dark colour. I also assume that you are developing your iOS app with latest version of iOS 9 or higher & latest version Swift & Xcode

 
Step 01: Click on your Project icon in your ‘Project Navigator’ tab in your respective projects left panel ‘Navigator’ tab.

 
Step 02: Select your project title under ‘Targets’

 
Step 03: Select ‘Info’ tab

(more…)

Continue Reading Post

How to programmatically change iOS app’s global tint colour, Navigation / Toolbar / Tab Bar’s tint (i.e. Text & Icon Colour) & bar tint colour (i.e. Background colour) using Swift Language while developing app in Xcode

Let’s get to the root of this topic,

 
Case: A case where you are developing your iOS app & you want to use your custom colour to colorise global tint colour for text & icon in your respective app & you also want to change tint & bar tint colour for Navigation Bar / Tab Bar / Tool Bar in your app.

 

Assumption: I assume you are well worse with iOS development in Xcode, You have embedded navigation controller to your app storyboard’s respective view controller & you have added tab bar view controller or dragged toolbar to your app’s view controller. I also assume you are using Swift as your programming language.

 
Solutions:

 

Note: You will have to copy following code in your iOS App’s AppDelegate.swift file’s ‘didFinishLaunchingWithOptions’ function while developing the same app in Xcode.

(more…)

Continue Reading Post