Results 1 to 2 of 2
Discuss [Objective C] Simple question at the iPhone Developer Exchange - Hackint0sh.org; Hey, I have implemented a singleton (sort of) in objective C with the following code: ...
  1. #1
    Newbie Array

    Join Date
    May 2008
    Posts
    4
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default [Objective C] Simple question

    Hey,

    I have implemented a singleton (sort of) in objective C with the following code:

    Code:
    + (Object *) globalInstance
    {
         static Object * pObj = nil;
         if ( !pObj )
            pObj = [[self alloc] init];
    
         return pObj;
    }
    I am attempting to implement a "setter" to set a UIView * inside of this singleton class...

    Code:
    - (void) setViewPointer:(UIView *)view
    {
         m_pView = view;
    }
    I am having trouble with the syntax of calling this function.. I was hoping for some help.. I have tried many variations, and cant seem to get the syntax down.

    I have tried :

    Code:
    [globalInstance setViewPointer:newView];
    [Object globalInstance.setViewPointer:newView];
    Any help would be great.



  2. #2
    Newbie Array

    Join Date
    Nov 2006
    Posts
    5
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    [[Object globalInstanct] setViewPointer:newView];

    or
    // Only works with @property declaration
    [Object globalInstance].viewPointer = newView;

    or

    Object * myObject = [Object globalInstance];
    [myObject setViewPointer:newView];

 

 

Similar Threads

  1. simple question -.-
    By oirartnoc in forum Installation
    Replies: 1
    Last Post: 11-01-2009, 01:08 PM
  2. hey a simple question if you can help thanks
    By boulie_jr in forum General
    Replies: 1
    Last Post: 02-13-2008, 01:18 AM
  3. question about maps app. simple question
    By 360boi in forum General
    Replies: 0
    Last Post: 10-25-2007, 08:50 AM
  4. Very simple question....
    By betomxl in forum iPhone "2G" (Rev. 1)
    Replies: 9
    Last Post: 10-16-2007, 05:26 AM
  5. Simple question, looking for a simple answer
    By squirrelycc in forum General
    Replies: 4
    Last Post: 09-10-2007, 08:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 12:31 PM.
twitter, follow us!