Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:12:25+00:00 2026-06-07T16:12:25+00:00

Following this tutorial, i ended up with a nice arrow for my UITabBar in

  • 0

Following this tutorial, i ended up with a nice arrow for my UITabBar in iPhone.

Now i wanted to do the same for iPad, but it seems to not work.

I tried

- (CGFloat) horizontalLocationFor:(NSUInteger)tabIndex
{   
    CGFloat tabItemWidth;
    CGFloat halfTabItemWidth;
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone){
        tabItemWidth = 320 / tabBarController.tabBar.items.count;
        halfTabItemWidth = (tabItemWidth / 2.0) - (tabBarArrow.frame.size.width / 2.0);
    }
    else 
    {
        tabItemWidth = 768 / tabBarController.tabBar.items.count;
        halfTabItemWidth = (tabItemWidth / 2) - (tabBarArrow.frame.size.width / 2);
    }

    return (tabIndex * tabItemWidth) + halfTabItemWidth;
}

following the example, taking the tabBar dimensions for iPad, but the arrow is still so far from being in the middle of each tab.

Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:12:27+00:00Added an answer on June 7, 2026 at 4:12 pm

    Try this in place of the current “horizontalLocationFor” method you have:

    - (CGFloat) horizontalLocationFor:(NSUInteger)tabIndex
    {
        // Get the frame of the selected tab item's view.
        // Add one becuase the first subview is the not a button.
        CGRect tabFrame = [[[[[self tabBarController] tabBar] subviews] objectAtIndex:tabIndex+1] frame];
    
        // Add tab x to half tab width and substract hald arrow image width to center it.
        return tabFrame.origin.x + (tabFrame.size.width * .5) - (tabBarArrow.frame.size.width * .5);
    }
    

    The original solution assumed that the tab bar width was the entire screen, but on ipad 4 items only fills a portion of the tab bar width, hence dividing the width by the number of items doesn’t get you the correct positions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following this tutorial http://aishack.in/tutorials/sudoku-grabber-with-opencv-detection/ But it's not fot the iOS. some methods described
I am following this tutorial http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-9 (not exactly same as this) I am trying
I was following this tutorial , but for the life of me I cant
I'm following this tutorial: ExpandableListView But in my device (Samsung Galaxy S i9000) the
I'm following this tutorial http://ruby.railstutorial.org/ The tutorial seems to be using Rails 3.0. I
i am following this tutorial: http://tutorial.symblog.co.uk/docs/validators-and-forms.html at the swift mailer part i am not
I'm following this tutorial: http://railscasts.com/episodes/253-carrierwave-file-uploads or atleast I want to but would like to
I'm following this tutorial attempting to learn XNA, but I'm having issues making my
I'm following this tutorial , but it fails when I try to push to
Kind of following this tutorial here: http://mobile.tutsplus.com/tutorials/iphone/iphone-core-data/ I use the fetch records method in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.