• 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
Global vars vs IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Global vars vs IB


  • Subject: Global vars vs IB
  • From: Michael Carter <email@hidden>
  • Date: Tue, 2 Mar 2004 05:01:01 -0800

Hello all.

I am new to Obj-C and XCode, and am trying to work out a scope issue.

I am building an app in XCode following the Model-Controller-View
paradigm. However, I am stuck on how to access a class instance I
defined in the controller class from my view class. In this app, a
barcode is generated and it's results displayed in an NSView. What I'm
trying to do is implement the NSDraggingSource protocol to allow a user
to drag the image of the created barcode to the Finder in order to save
it as an EPS file.

In the view I am using
dragImage:at:offset:event:pasteboard:source:slideBack: in order to
allow the drag, however, I need to get to the instance of the barcode
class to obtain the EPS source I must create my NSPasteboard with. This
instance is declared in the controller object.

[MyBarcode] -> [Controller] -> [MyView]

The way I see it so far, I can either make the barcode instance global
in scope somehow, pass the instance around willy-nilly or perhaps
instantiate the barcode class in IB and make an outlet where the view
can send a message similar to [barcode sendMeTheEPSCode]. Which would
be the best approach? Would an object calling this message get the same
object that the controller has instantiated?

Thanks in advance.

______________
Mike Carter
Pilot/Programmer
Aviate.Org
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Global vars vs IB
      • From: Ryan Bates <email@hidden>
  • Prev by Date: Closing many windows with toolbars very slow
  • Next by Date: Re: Closing many windows with toolbars very slow
  • Previous by thread: Re: Closing many windows with toolbars very slow
  • Next by thread: Re: Global vars vs IB
  • Index(es):
    • Date
    • Thread