• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
access to object from a different class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

access to object from a different class


  • Subject: access to object from a different class
  • From: jon <email@hidden>
  • Date: Fri, 18 Sep 2009 15:52:34 -0600

Ok, I did not get the desired result, but i am a little closer, I'm going to set this up again.
below is example code to set up the circumstance, so you better see what i want to do. (stripped down to what i am trying to find out) (webView is hooked up in IB to a WebView object)


(i want to replace the ???? with something that would work where theWebView is pointing to the same thing as "webView" from the first class a pointer to the current WebView object)

In first class, I have set webView up like this... which works fine, but i want to have access to this current webView object from a different class

how does one go about getting at the instance "webView" coding wize???

Jon.

header of class WebViewController:
-------------------------------------------------------------------------
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>

@interface WebViewController : NSDocument
{
	IBOutlet WebView *webView;
}

@property(readwrite,retain) WebView *webView;

@end
-------------------------------------------------------------------------

implementation of class WebViewController:
-------------------------------------------------------------------------
#import "WebViewController.h"

@implementation WebViewController

@synthesize webView;

@end
-------------------------------------------------------------------------

header of class BookMarkController:
-------------------------------------------------------------------------
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
#import "WebViewController.h"

@class WebView;

@interface BookMarkController : NSWindowController
{
	WebViewController *aController;
	WebView *theWebView;
}

@end
-------------------------------------------------------------------------

implementation of class BookMarkController:
-------------------------------------------------------------------------
#import "BookMarkController.h"

@implementation BookMarkController

- (void)setup
{
theWebView = ????? (i want to point to the same thing as webView's pointer to it's instance) or basically----> theWebView = webView;
}


@end
-------------------------------------------------------------------------
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Menu shortcuts without modifiers?
  • Next by Date: Re: getting accessor method info in a different class.
  • Previous by thread: Re: Problem with fontDescriptorWithFontAttributes:
  • Next by thread: iPhone Segmentation Fault
  • Index(es):
    • Date
    • Thread