Mandar Apte

UI/UX Designer from Mumbai, Maharashtra, India.

Category: Tutorials

Free Tutorials

  • Cloudflare Flexible SSL Certificate Implementation Guide for WordPress Website.

    Prerequisite:
    Please ensure you have an active CloudFlare account and have added your WordPress Website to CloudFlare. Also, make sure you are using CloudFlare nameservers for your domain.

    Step 01:
    Sign in to your CloudFlare account

    Step 02:
    Make sure a flexible SSL certificate is enabled under the “Crypto” tab for your selected website

    Step 03:
    While signing in to your CloudFlare account, go to > My Profile, Scroll down to API Keys, locate the Global API Key, and copy the key for further use inside your website.

    (more…)
  • Set UIImageView Image Inset for iOS and iPadOS app.

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

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

    Here is step by step procedure to achieve the designed result:

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

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

    @IBOutlet weak var imageView: UIImageView!
    

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

    (more…)
  • Animate tab bar switches with a transition effect for UITabBarViewController.

    I was searching the web for answers on how to give the CurlUp / CrossDissolve / FlipFromRight / FlipFromLeft / CurlDown / FlipFromTop / FlipFromBottom transition effect for the UITabBar Tab Switch.

    I found this answer, but it has a bug or a black screen when you tap on the same tab twice, i.e., the destination and current tab are the same.

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

    So here is the final answer without any bugs.

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

    UITabBarController, UITabBarControllerDelegate
    

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

    self.delegate = self
    
    (more…)
  • Hide the Navigation Bar on Scroll.

    Assumption:
    I assume you have embedded UINavigationBar inside your Apple iOS app on Storyboard.

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

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

    (more…)
  • Programmatically change the UITabBar Tint Color and the UITabBar Item selected and unselected icon tint color.

    Assumption:
    I assume you have deployed UITabBarViewController in your iOS App. Now you want to change the Tint color of the UITabBar, the Tint color of the UITabBar item, and the tint color of the UITabBar’s unselected icon.

    Doing this is just as simple as a single line of code.

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

    So your code will look something like this.

    (more…)
  • Programmatically set the icon/image for the Tab Bar Item in UITabBarViewController.

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

    Copy the following code using your current View Controller’s ViewdidLoad method.

    (more…)
  • Programmatically change the titles of tabs in UITabBarViewController. Change the title of the Navigation Bar for each UITabBarViewController.

    Let’s assume you use Tab Bar View Controller in your Xcode 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…)
  • Change < Back button text of iOS or iPadOS App.

    While we use app development methodologies like MVC (Model, View, Controller), we encounter problems navigating from one view to another. How do you change the text of the back button, which gets populated automatically by the Apple iOS operating system?

    You can use the below method in the 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 the ‘prepare for segue’ method of your app:

    (more…)
  • Identify whether a user is on an iPhone or iPad and whether the device is in portrait or landscape mode.

    We will explore ways to identify the user’s iPad or iPhone device. With the latest Xcode build, we will do all this in Swift Programming Language.

    iOS devices will be identified in four ways: .phone, .pad, .tv & .unspecified.

    So the 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…)
  • Using SKStoreReviewController API to prompt users to write reviews for your App.

    Introduction to StoreKit and Apple App Store policies

    I will write down a few concepts & ideas to help you understand how 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. Users can also choose to write reviews for iOS and macOS apps.

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

    About Summery of Ratings

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

    The developer can reset your app’s summary rating by releasing a new version of the app.

    The right way to ask for Ratings and Reviews

    The developer can ask users to rate and review your app when they are most likely to feel satisfied, such as when they have completed an action, level, or task.

    This will give users an easy way to provide feedback on the App Store without leaving your app.

    The developer can prompt for rating a maximum of three times in 365 days.

    Users will submit a rating through the standardised prompt.

    Presenting the Review Prompt

    Although you should call this method when it makes sense in the user experience flow of your app, the actual display of a rating/review request view is governed by App Store policy. In addition, because this method may or may not present an alert, it’s not appropriate to call it in response to a button tap or other user action.

    When you call this method in development mode, the review request view is always displayed so that you can test your app on your device. However, this method will not be called when distributing your app using TestFlight.

    When you call this method in your App Store-published app, a review request view will be presented, and the operating system will handle the entire presentation process.

    (more…)