Mandar Apte

UI/UX Designer from Mumbai, Maharashtra, India.

Category: Apple iOS

iOS (originally iPhone OS) is a mobile operating system created and developed by Apple Inc. and distributed exclusively for Apple hardware. It is the operating system that presently powers many of the company’s mobile devices, including the iPhone, iPad, and iPod touch.

  • 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…)
  • Colour Behaviour Study of Japan / True Black on Real Life Physical Paper & on Computer Displays or Screens

    I am now documenting some thoughts about black colour behaviour on Physical Paper & computer displays or screens.

    I was from a BFA (Bachelor of Fine Arts) – Applied Art background, so we had subjects like Illustration, Calligraphy, Typography, Print Media Design, Logo & Symbol Design, Branding & Identity Design.

    We used to design our assignments using Japan Black ink which is very dark in contrast & which creates high contrast reach feeling of black colour tone on white paper.

    So when we print our designs in Adobe Illustrator or CorelDraw, we fill the design with (CMYK) Cyan: 100%, Magenta: 100%, Yellow: 100%, K(Black): 100%, then using only K: 100%. These CMYK values use to create high-contrast Japan Black ink fill on White Paper.

    (more…)
  • Identify the iPhone or iPad model programmatically using Swift Language.

    You may be programming a Universal App for iPhone, iPad, or iPad Pro and wondering how to write conditional code for those variant iOS device sizes.

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

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

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

    (more…)
  • Call function from FirstViewController to SecondViewController using Swift Programming Language.

    Here is the situation in your Xcode project where you want to call a 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 a superclass.

    The second swift that you want to call a function from, we will assume that it has ‘SecondViewController’ as the class name & it has ‘UIViewController’ as a superclass.

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

    So, you will write a print function as follows:

    (more…)
  • What does the Trust this Computer functionality mean, and what if you accidentally tapped on Don’t Trust this Computer and want to reset it?

    What do trust settings mean to your iOS & macOS device

    When you connect your iPhone, iPad, or iPod touch to a computer for the first time, an alert asks whether you want to trust this computer or not.

    Relationships of Trusted Devices:

    1. Trusted computers can sync with your iOS device, create backups, and access your device’s photos, videos, contacts, and other content.
    2. These computers remain trusted until you change device privacy settings or erase your iOS device.
    3. If you choose not to trust a computer, you block its access to content on your device. You’ll see the trust alert whenever you connect your iOS device to that computer.
    ios9-trust-this-computer-alert-message
    (more…)
  • Fix Xcode error ‘Unable to boot iOS Simulator’

    Background:

    Xcode is a one-stop development app for OSX and iOS devices, including all Macintosh Desktops, laptops, iPhones, iPads, and iPod touch.

    Note: I Assume you are on OSX Yosemite 10.10.3 or the Latest Operating System & Xcode 6 or later installed.

    With the release of Xcode 6 and later, while developing and running your iOS app in iOS Simulator on your Mac, you may encounter a bug like this: ‘Unable to boot iOS Simulator’ with a blank screen.

    Unable to boot iOS Simulator in Xcode

    Here is how to fix it

    Solution 01:

    Select iOS Simulator, then go to top Menubar > iOS Simulator > Reset Content and Settings > Reset (On command prompt, press reset)

    (more…)