title: How to change the position of tab bar icon for ipad in swift?
body: <p>I have some custom design with tab bar and I have almost achieved my custom design but in ipad it's not working as my custom button is not center aligned even label is also not center aligned. In fact the whole layout is changed in ipad, in iphone layout is shown in vertical stack but in ipad layout is shown in horizontal stack but for my custom button I want it in center aligned same as iphone but only for middle bar item. For this I am thinking to change the position of the button and label in case of ipad, I want to give margin from left but how would I achieve this no idea. If anybody knows the solution please help me out.</p>
  <p>tab bar controller class</p>
  <pre><code>import UIKit
  import SwiftIcons
  
  class HomeViewController: UITabBarController, UITabBarControllerDelegate {
  
      required init(coder aDecoder: NSCoder) {
          super.init(coder: aDecoder)!
      }
      override func viewDidLoad() {
          super.viewDidLoad()
          self.delegate = self
          
          let selectedColor   = UIColor(red: 16.0/255.0, green: 78.0/255.0, blue: 91.0/255.0, alpha: 1.0)
          let unselectedColor = UIColor(red: 16.0/255.0, green: 224.0/255.0, blue: 223.0/255.0, alpha: 1.0)
  
          UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: unselectedColor], for: .normal)
          UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: selectedColor], for: .selected)
          
              
          //store every image in a variable
          
          let userUnselectedImage: UIImage = UIImage(named: &quot;add_workout_icon&quot;)!.withRenderingMode(UIImage.RenderingMode.alwaysOriginal)
          let userSelectedImage: UIImage = UIImage(named: &quot;add_workout_icon&quot;)!.withRenderingMode(UIImage.RenderingMode.alwaysOriginal)
          
              tabBar.items![2].image = userUnselectedImage
              tabBar.items![2].selectedImage = userSelectedImage
          
      }
      
  }
  </code></pre>
  <p>iphone image
  <a href="https://i.stack.imgur.com/SL25o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SL25o.png" alt="iphone image" /></a></p>
  <p>ipad image: issue
  <a href="https://i.stack.imgur.com/bIl1e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bIl1e.png" alt="ipad image" /></a></p>