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 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 to programmatically identify if user is on iPhone or iPad. There is also way to find out if user is on either device and if it is in portrait mode, landscape mode.

We will explore our ways to identify device of user whether it is iPad or iPhone, We will do all this in Swift Programming Language with latest Xcode build.

 
There four ways that iOS device will get identified .phone, .pad, .tv & .unspecified.

 
So code will look like this in swift

 
Code for iOS 13, iPadOS 13, macOS 10.15 Catalyst and above:

 

if UIDevice.current.userInterfaceIdiom == .phone {
    
} else if UIDevice.current.userInterfaceIdiom == .pad {
    
} else if UIDevice.current.userInterfaceIdiom == .carPlay {
    
} else if UIDevice.current.userInterfaceIdiom == .tv {
    
} else if UIDevice.current.userInterfaceIdiom == .unspecified {
    
}

 
Code for iOS 12 and below:

 

if (UIScreen.main.traitCollection.userInterfaceIdiom == UIUserInterfaceIdiom.pad) {
    print("It's iPad")
    // Your code here
    
} else if (UIScreen.main.traitCollection.userInterfaceIdiom == UIUserInterfaceIdiom.phone) {
    print("It's iPhone")
    // Your code here
    
} else if (UIScreen.main.traitCollection.userInterfaceIdiom == UIUserInterfaceIdiom.tv) {
    print("It's Apple TV")
    // Your code here
    
} else if (UIScreen.main.traitCollection.userInterfaceIdiom == UIUserInterfaceIdiom.unspecified) {
    print("It's Unknown Device")
    // Your code here
    
}

(more…)

Continue Reading Post

What is Apple Store Kit Framework and how to write code for SKStoreReviewController API which will prompt user to write review for you App while using your app & without leaving your app

Introduction to StoreKit and Apple App Store policies

 
I will write down few concepts & ideas to help you understand to implement StoreKit app review functionality in your app using Xcode.

 
Important Points to remember

 
You can ask your users to rate your app on a scale of 1 to 5 stars. User can also choose to write review for iOS and macOS apps.

 
Developer can view, sort and respond to reviews in iTunes Connect.

 
About Summery of Ratings

 
Every App Store app has one summary rating on product page, specific to each territory on the App Store.

 
Developer can reset your app’s summary rating with release a new version of app.

(more…)

Continue Reading Post

How to fix if ‘My Photo Stream’ is not working on your Apple iOS Devices including iPhone, iPad and iPod touch

I have jot down few points to check why My Photo Stream is not working in your iOS Device & syncing Photos across iOS & OSX devices.

 
Solution & Few Check Points:

  1. You are sign in to iCloud using your preferred active Apple ID
  2. ‘My Photo Stream’ is checked & on your device under iOS Settings App under iCloud Photos related Section
  3. (more…)

Continue Reading Post

How to fix if ‘My Photo Stream’ is not working on your Macintosh / OSX including on your iMac, MacBook, MacBook Pro, MacMini, Mac Pro Computers

Here is the solution if your ‘My Photo Stream’ iCloud Apple Photos App feature is not working correctly.

 
Assumption:

  1. You have sign in your iCloud Account on Your Mac
  2. My Photo Stream is selected & Active inside your System Preferences > iCloud > Photos App Settings

(more…)

Continue Reading Post

How to identify user is on iPhone, iPad or iPod touch by accessing their device width property. In other words how to write conditional code for 3.5 inch iPhone, 4 Inch iPhone, 4.7 inch iPhone, 5.5 inch iPhone, 9.7 inch iPad, 12.9 inch iPad

You may be programming Universal App for iPhone, iPad, iPad Pro & iPod touch. And you may be wondering how to write conditional code for that variant iOS device sizes.

 
So here is how to write code by identifying device height of your display or frame.

 
Here is how to solve this situation by identifying device height,

 

Note: This code uses native bounds of device so this code will work for all current devices that may be in landscape or portrait mode. Code is written in Swift Programming Language.

(more…)

Continue Reading Post