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

  • Home
  • SEARCH
  • 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 6318775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:41:05+00:00 2026-05-24T15:41:05+00:00

I work on a project for iPhone iOS4 with Xcode 4. My app uses

  • 0

I work on a project for iPhone iOS4 with Xcode 4.

My app uses a tabBar for two Views with two View Controllers.

I want to programmatically create a Button in a View and to have same button in the other view.

For “same button” I mean that buttons have same background Image, same Title and so on. Also, when I programmatically change first button title also second button title change; same for backgrounds.

I was thinking something like “passing the pointer”, but I do not know how to do it, how to pass a pointer from a View to another View. (I have a singleton GlobalData, if it can help.)

Thank you.

  • 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-24T15:41:06+00:00Added an answer on May 24, 2026 at 3:41 pm

    What you want to do is to create a custom UIButton, and then just use it wherever you need it. Once you change it in it’s implementation file it will change globally.

    Example CustomButton

    //CustomButton.h
    
    #import <UIKit/UIKit.h>
    
    @interface CustomButton : UIButton{
    
    }
    @end
    
    
    //CustomButton.m
    
    #import "CustomButton.h"
    
    @implementation CustomButton
    
    - (id)init
    {
        self = [super init];
        if (self) {
            self.type = UIButtonTypeCustom;
            self.frame = CGRectMake(170, 45, 150, 40);
            [self setTitle:@"Title" forState:UIControlStateNormal];
            [self.titleLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:15]];
            [self setBackgroundImage:[UIImage imageNamed:@"bg_image.png"] forState:UIControlStateNormal];
        }
    
        return self;
    }
    
    @end
    

    Then use it like so:

    #import "CustomButton.h"
    
    ...
    
    CustomButton *myButton = [[CustomButton alloc] init];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I work on a project that uses multiple open source Java libraries. When upgrades
I am starting a new client/server project at work and I want to start
I have a 32bit iMac that I am writing an iPhone app in Xcode
I've got an iPhone project and my english Localizable.strings suddenly doesn't work anymore. I
I have an iPhone project that uses GHUnit to conduct unit testing. Recently, I've
I have a fairly large work project that uses pygtk for the GUI and
I'm trying to work through Project Euler and I'm hitting a barrier on problem
I'm starting work on a project using Rails, but I'm waiting for the 3rd
I recently had to work on a project where the previous developer modified the
I've started work on a project that will be primarily acting as a Sync

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.