Mandar Apte

UI/UX Designer from Mumbai, Maharashtra, India.

Category: Apple Xcode

Xcode is an integrated development environment (IDE) containing a suite of software development tools developed by Apple for developing software for OS X and iOS.

  • 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…)
  • 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…)
  • 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…)
  • Fix the Xcode Storyboard error. The ‘Frame for “Text View” will be different at run time.’

    The Xcode error called ‘Frame for “Text View” will be different at run time.’ is frequent when you are trying to utilise Auto Layout by using reset to suggested constraints in Xcode Storyboard.

    So here is how to fix it:

    Step 01:
    Above Debug: In your Xcode Storyboard view screen, you will have four buttons at the extreme right. Use the pin button, third from right, to add new constraints per item at the top, right, bottom, and left, and uncheck the constraint to margins.

    ios-xcode-app-storyboard-pin-debug-area
    (more…)
  • Write an iOS/iPadOS app code to transition from one screen to another.

    There are instances when you want to transition or navigate from one UI screen to another by pressing a button.

    Yes, you can link the button visually by control-clicking on it and then linking it to the required UI Screen on the storyboard.

    But I will show you how you can do it programmatically with code defined & working differently for iPad & iPhone Storyboards.

    I have used iOS Conditional coding syntax to differentiate iPhone & iPad Storyboards

    Note: You can read about iOS Conditional Coding Here, How to detect user is using iPad or iPhone for iOS App at run time conditional coding purposes

    (more…)
  • How to hide the ‘Back’ button on the iOS/iPadOS App.

    You want to hide this ‘Back’ button when you transition from one screen to the next, probably the detail view screen, where Xcode automatically puts this for you without asking if you want it.

    You can copy the below code to your ‘viewDidLoad’ method in your respective file:

    Objective-C Code:

    [self.navigationItem setHidesBackButton:YES animated: YES];
    

    Swift Code:

    self.navigationItem.setHidesBackButton(true, animated: true);
    

    Hope it helps,

    Thanks & Regards
    Mandar Apte

  • How do you fix the iTunes Connect error ‘No identities are available for signing’? This error appears whenever you try to upload your iOS App binary from Xcode to iTunes Connect.

    The issue of ‘No identities are available for signing’ starts with the default behaviour of Xcode when you create a new app in Xcode itself,

    You fill up the following information in Xcode while creating a new app for iOS,

    creat new project xcode ios bundle idetifier organisation idetifier product name

    i.e. Product Name, Organisation Name, Company Identifier & it generates bundle identifier based on your inputs

    Apple, by default, forcefully inserts ‘Product Name’ into the bundle identifier without prompting or even asking the user whether they want it.

    So when you ignore this situation & start building your app…

    At the time of uploading your app to the Apple App Store through iTunes Connect, i.e. ITC, it throws the following error at you

    Error Name: No identities are available for signing

    So here is a workaround & solution for this error:

    (more…)