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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:34:23+00:00 2026-06-15T05:34:23+00:00

I have a singleton I implement in this way: PhotoViewController* sharedSingleton = [PhotoViewController sharedManager];

  • 0

I have a singleton I implement in this way:

PhotoViewController* sharedSingleton = [PhotoViewController sharedManager];

I know that to launch a method I have to do [sharedSingleton method];

but what if I want to change an integer declared in the PhotoViewController.h file as NSInteger* tagNumber, hoe can I do that? I tried this:

[sharedSingleton.tagNumber = 1];

but it doesn’t work!

EDIT:

error: property tagNUmber not found on object of type photoViewController

@interface PhotoViewController : UIViewController{

BOOL newMedia;
UIPopoverController *popoverController;
DBRestClient *restClient;
NSInteger* tagNumber;
}

+ (PhotoViewController *) sharedManager;

@end
  • 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-15T05:34:24+00:00Added an answer on June 15, 2026 at 5:34 am

    Singletons are regular objects. The only difference is that only one instance will be created from the class.

    If you aren’t able to set the tagNumber it is likely that some other type of coding error is happening… perhaps the tagNumber property was declared in a class extension, making the accessor/mutator methods private?

    If you edit your question with how the tagNumber is declared, and also include the error message you are getting, I’ll be able to edit this answer and give you more specific advice.

    EDIT: …and yes, definitely double check to make sure you didn’t declare the NSInteger to be a pointer… an NSInteger is a scalar type (so it takes a direct value, and doesn’t use the dereference ‘*’ operator).

    I suggest using properties instead of accessing the instance variables directly:

    @interface PhotoViewController : UIViewController
    
    @property (nonatomic, assign) BOOL newMedia;
    @property (nonatomic, strong) UIPopoverController *popoverController;
    @property (nonatomic, strong) DBRestClient *restClient;
    @property (nonatomic, assign) NSInteger tagNumber;
    
    + (PhotoViewController *) sharedManager;
    
    @end
    

    Then set the variable without the brackets as:

    sharedSingleton.tagNumber = 1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is a good way to implement a singleton that will be restricted only
I have a java singleton class that has my application settings. I used this
I have a singleton class that is shared by some threads. within a method
I'm trying to implement a fire-and-forget pattern in a WCF method. I have this
I have a singleton implemented like this: class Test123(object): _instance = None def __new__(cls,
Looking at this article: http://www.galloway.me.uk/tutorials/singleton-classes/ I have implemented a singleton, my question is the
I want to implement singleten design pattern in iphone code I have one array.
I have a singleton class for global access to config information. This singleton class
I have a Singleton that is accessed in my class via a static property
I have a singleton object that use another object (not singleton), to require some

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.