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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:46:27+00:00 2026-05-23T14:46:27+00:00

Anywhere there is a UIButton in my app i would like it to have

  • 0

Anywhere there is a UIButton in my app i would like it to have a specific background image. This background image will always be the same.

What i dont want to have to do is call a method on every button that i put into my UI.

Can i do this via a category or something similar?

  • 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-05-23T14:46:28+00:00Added an answer on May 23, 2026 at 2:46 pm

    You can’t change global appearance of your button via simple code (in current SDK).


    BUT, You can subclass your UIButton. For example:

    .h
    
    @interface MyButton : UIButton
    
    @end
    
    ---
    
    .m
    
    @implementation MyButton
    
    // your customization code
    
    @end
    

    And if you want to insert an UIButton instance like:

    UIButton *button = // init your button
    // customize your button
    [self.view addSubview:button];
    

    you have to change UIButton to MyButton

    Mybutton *button=  // init your button
    [self.view addSubview:button];
    

    Don’t forget about #import "MyButton.h" in your .m / .h file.


    EDIT: Where should you make customizations:

    @implementation UIButton (MyCategory)
    
    + (id)buttonWithFrame:(CGRect)frame {
        return [[[self alloc] initWithFrame:frame] autorelease];
    }
    
    - (id)initWithFrame:(CGRect)frame {
      if (self = [super initWithFrame:frame]) {
        // HERE YOU CAN DO SOME CUSTOMIZATION
      }
      return self;
    }
    

    Then, somewhere in your viewController:

    UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(x, y, width, height)];
    

    or:

    UIButton *btn = [UIButton buttonWithFrame:CGRectMake(x, y, width, height)];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found this image, which represents r* expression NFA. My question is: there
Before I get anywhere with this post, let me make this clear, there is
Is there anywhere I can download the stand-alone JSEclipse plugin, it seems like it
I'm new to this sort of thing, but I would like to create a
Is there anywhere in the service runtime that would tell me if I'm currently
I have a string that looks like this. It's obviously a multi-line string and
Is there anywhere a ready to use RichText Toolbar for GWT? It would be
Does anyone know anywhere there's a wide collection of Python source code on the
Subject says it all really...Is there anywhere a good tutorial for Xcode's Debugger out
Are there statistics or even estimates anywhere regarding the sizes of the various sectors

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.