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 8846617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:02:13+00:00 2026-06-14T12:02:13+00:00

I am building a Rubymotion app and I am customizing the tabBar. I have

  • 0

I am building a Rubymotion app and I am customizing the tabBar.
I have managed to put a custom image as a background of the tabBar but now I need
to set individual images to each tab. One for when it is pressed and one for when it is not.

I am following the guide (for objective-c) at NSScreencasts.com and the show notes says I should use this code. But when I try it in Ruby (which I think is correct) I get an error.

In Objective-C:

- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Friends"
                                                        image:nil
                                                          tag:0];
        [self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"tabbar-activity-selected.png"]
                      withFinishedUnselectedImage:[UIImage imageNamed:@"tabbar-activity.png"]];
    }
    return self;
}

My Ruby code:

class FirstController < UIViewController
  def viewDidLoad
    super

    view.backgroundColor = UIColor.whiteColor 

    self.tabBarItem = UITabBarItem.alloc.initWithTitle('Friends', image: nil, tag: 0)
    self.tabBarItem.setFinishedSelectedImage(UIImage.imageNamed('tabitem_selected.png'))
    self.tabBarItem.withFinishedUnselectedImage(UIImage.imageNamed('tabitem.png')) 
  end
end

The error:

first_controller.rb:8:in `viewDidLoad': undefined method `setFinishedSelectedImage' for #<UITabBarItem:0x6b71670> (NoMethodError)
    from app_delegate.rb:7:in `application:didFinishLaunchingWithOptions:'
2012-11-16 14:45:56.924 custom_tabbar[45679:f803] *** Terminating app due to uncaught exception 'NoMethodError', reason: 'first_controller.rb:8:in `viewDidLoad': undefined method `setFinishedSelectedImage' for #<UITabBarItem:0x6b71670> (NoMethodError)

Also. Is it really correct to set this code in the viewDidLoad?

  • 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-14T12:02:14+00:00Added an answer on June 14, 2026 at 12:02 pm

    These lines in Objective-C are one method:

    [self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"tabbar-activity-selected.png"]
                  withFinishedUnselectedImage:[UIImage imageNamed:@"tabbar-activity.png"]];
    

    The signature is:

    - (void)setFinishedSelectedImage:(UIImage *)selectedImage 
         withFinishedUnselectedImage:(UIImage *)unselectedImage
    

    So for RubyMotion, the method signature is:

    setFinishedSelectedImage(image, withFinishedUnselectedImage:image)
    

    Which converts to this for you:

    self.tabBarItem.setFinishedSelectedImage(UIImage.imageNamed('tabitem_selected.png'),
                                             withFinishedUnselectedImage: UIImage.imageNamed('tabitem.png'))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an iOS app using Rubymotion and I need to set the
Building a lottery scratch-card app in Java. Have allot of it done, just need
Building an iPad app. I have a button on my main view that I
Building an MVC 3 app with Razor and I have some information persisted in
Building a Shopping Cart app. Some products have options, some don't. I visitor can
Building an offline web app in VS2010. I have a master page with a
Building a Silverlight 5 app that runs in the browser but getting some nagging
Building on this question , now I have another problem. Given this, shipments =
Building an inventory system. I have lots of products and each product has three
Building a Django app on a VPS. I am not very experienced with setting

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.