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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:01:32+00:00 2026-05-12T00:01:32+00:00

I’m new to programming for the iPhone and i’m wondering: how extensible are the

  • 0

I’m new to programming for the iPhone and i’m wondering: how extensible are the various controls? Let’s take the button as an example:

  • can i change the background graphic?
  • can i make it grow larger when i press on it?
  • can i change the font?
  • can i use a custom font?
  • can i use a button graphic in place of text?
  • 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-12T00:01:32+00:00Added an answer on May 12, 2026 at 12:01 am

    In general, yes to all your questions. You can subclass the various UI* classes that make up the Cocoa touch controls just like any other classes, and add your own custom functionality in the appropriate methods. The only tricky part is figuring out where exactly your code should go.

    Let’s look at your UIButton example, and walk through what you want to do with it.

    Background image

    The UIButton class already has a method setBackgroundImage:forState: that lets you change the UIImage the button displays when it’s in one of several states, such as Normal, Highlighted, Disabled, and so on.

    For example, to change the image the button displays as a normal background to “backgroundImage.png”, which is an image file in your application’s bundle:

    //Presuming you have some UIButton *button:
    UIImage *bgImage = [UIImage imageNamed:@"backgroundImage.png"];
    [button setBackgroundImage:bgImage forState:UIControlStateNormal];

    Growing larger

    You can change the button’s frame (an inherited property from UIView) by adding a method to do so in the view controller .m file that manages the button, then adding that method as an action for a control event on the button.

    Let’s say you want to double the size of the button. In viewDidLoad: or somewhere similar, add the following code:

    [button addTarget:self action:@selector(growButton) 
                 forControlEvents:UIControlEventTouchDown];

    Then create a method growButton with the following code:

    - (void)growButton {
        CGRect currentFrame = button.frame;
        CGRect newFrame = CGRectMake(currentFrame.origin.x - currentFrame.size.width / 2,
                                     currentFrame.origin.y - currentFrame.size.height / 2,
                                     currentFrame.size.width * 2,
                                     currentFrame.size.height * 2);
        button.frame = newFrame;
    }

    This doubles your button’s size while keeping its center the same. (Be careful your button doesn’t grow over the edge of your view when you do this.)

    Changing the font

    Simply change the font property of the UIButton – set it to a new instance of UIFont, like in this example:

    button.font = [UIFont systemFontOfSize:16.0];

    This changes the button’s font to the system’s font with size 16.

    Custom font

    This is a somewhat trickier question, as I’m pretty sure you can’t load your own custom font files, even if you include them in your app bundle. You can, however, change the default font of a control by using UIFont’s fontWithName:size: class method. All the font names are available through UIFont’s familyNames and fontNamesForFamilyName: methods.

    Button graphics instead of text

    This is the simplest of the five – just don’t set the text on the button, but instead set a background image for UIControlStateNormal (see above).

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

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Can I edit an excel file from a browser using… May 12, 2026 at 1:03 am
  • Editorial Team
    Editorial Team added an answer Your service needs to support jsonp which means the response… May 12, 2026 at 1:03 am
  • Editorial Team
    Editorial Team added an answer The remove() function does not use regexes. Does your file… May 12, 2026 at 1:03 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.