FROM : Hamish Allan
DATE : Sat May 24 14:12:51 2008
On Sat, May 24, 2008 at 1:21 AM, Johnny Lundy <<email_removed>> wrote:
> I have used it to set my class as its delegate so that I could implement the
> delegate method applicationWillTerminate:, and that was great. Easy to
> understand, it calls respondsToSelector: and then calls my delegate method.
> Cool. But as far as the "serves as a proxy for the object that owns the
> nib", why does a nib need an owner? Why do I care who the owner is? My
> NSArrayControllers can be bound to model objects without anything going
> through File's Owner.
They can indeed. You can use your nib-instantiated controller object's
awakeFromNib method to set up your model objects, and wire your main
menu's Open and Save items directly to methods in that controller. But
if you ever want to use more than one controller, you'll probably have
to start using methods like applicationDidFinishLaunching: (for
synchronisation). That code path, as well as
applicationWillTerminate:, goes through an object outside your nib
(NSApplication), even though it's subsequently calling a delegate
method inside your nib.
Incidentally, have you ever written a document-based cocoa app?
> Now if what they are trying to say is that I can bind a controller to File's
> Owner and it will "see" all the properties of all the objects in the class
> that File's Owner is set to, that would be cool.
That is exactly what they are saying.
> In that case it is just
> serving as an instance of a class and can be used to reach properties of
> objects of that class.
Well, it's serving as a *proxy* for an *existing* instance of a class.
Whereas instantiating an NSObject in the nib creates an instance and
allows you to make connections to it, you can use File's Owner to make
connections to an object that exists prior to loading of, and outside
of, the nib.
Hamish
DATE : Sat May 24 14:12:51 2008
On Sat, May 24, 2008 at 1:21 AM, Johnny Lundy <<email_removed>> wrote:
> I have used it to set my class as its delegate so that I could implement the
> delegate method applicationWillTerminate:, and that was great. Easy to
> understand, it calls respondsToSelector: and then calls my delegate method.
> Cool. But as far as the "serves as a proxy for the object that owns the
> nib", why does a nib need an owner? Why do I care who the owner is? My
> NSArrayControllers can be bound to model objects without anything going
> through File's Owner.
They can indeed. You can use your nib-instantiated controller object's
awakeFromNib method to set up your model objects, and wire your main
menu's Open and Save items directly to methods in that controller. But
if you ever want to use more than one controller, you'll probably have
to start using methods like applicationDidFinishLaunching: (for
synchronisation). That code path, as well as
applicationWillTerminate:, goes through an object outside your nib
(NSApplication), even though it's subsequently calling a delegate
method inside your nib.
Incidentally, have you ever written a document-based cocoa app?
> Now if what they are trying to say is that I can bind a controller to File's
> Owner and it will "see" all the properties of all the objects in the class
> that File's Owner is set to, that would be cool.
That is exactly what they are saying.
> In that case it is just
> serving as an instance of a class and can be used to reach properties of
> objects of that class.
Well, it's serving as a *proxy* for an *existing* instance of a class.
Whereas instantiating an NSObject in the nib creates an instance and
allows you to make connections to it, you can use File's Owner to make
connections to an object that exists prior to loading of, and outside
of, the nib.
Hamish
| Related mails | Author | Date |
|---|---|---|
| Johnny Lundy | May 23, 20:49 | |
| Matt Long | May 23, 21:13 | |
| Erik Buck | May 23, 21:30 | |
| Ken Thomases | May 23, 21:33 | |
| Brian Stern | May 23, 22:00 | |
| Shawn Erickson | May 23, 22:27 | |
| Andy Lee | May 23, 22:55 | |
| Shawn Erickson | May 23, 23:07 | |
| Shawn Erickson | May 23, 23:11 | |
| Steve Weller | May 24, 00:17 | |
| Hamish Allan | May 24, 00:30 | |
| Julien Jalon | May 24, 01:36 | |
| Johnny Lundy | May 24, 02:21 | |
| Johnny Lundy | May 24, 03:19 | |
| Jonathan Hess | May 24, 03:32 | |
| Erik Buck | May 24, 03:55 | |
| Jason Stephenson | May 24, 03:57 | |
| Johnny Lundy | May 24, 04:31 | |
| Scott Ribe | May 24, 04:38 | |
| Andy Lee | May 24, 04:58 | |
| Scott Ribe | May 24, 05:01 | |
| Jonathan Hendry | May 24, 05:41 | |
| Andreas Mayer | May 24, 06:39 | |
| Paul Sargent | May 24, 12:49 | |
| Sherm Pendley | May 24, 13:02 | |
| Hamish Allan | May 24, 14:12 | |
| Johnny Lundy | May 25, 00:25 | |
| Ken Thomases | May 25, 04:57 | |
| Johnny Lundy | May 25, 09:15 | |
| Scott Anguish | May 25, 09:49 | |
| Jens Alfke | May 25, 09:52 | |
| Ken Thomases | May 25, 10:17 | |
| Paul Thomas | May 25, 10:31 | |
| Roland King | May 25, 11:01 | |
| mmalc crawford | May 25, 11:14 | |
| Ken Thomases | May 25, 11:44 | |
| mmalc crawford | May 25, 12:20 | |
| Graham Cox | May 25, 14:02 | |
| Andy Lee | May 25, 15:31 | |
| Johnny Lundy | May 25, 18:13 | |
| mmalc crawford | May 25, 19:17 | |
| mmalc crawford | May 25, 19:22 | |
| Andy Lee | May 25, 19:30 | |
| mmalc crawford | May 25, 19:42 | |
| Hamish Allan | May 25, 20:58 | |
| Johnny Lundy | May 25, 21:12 | |
| Johnny Lundy | May 25, 21:27 | |
| Jens Alfke | May 25, 21:51 | |
| Sherman Pendley | May 25, 21:53 | |
| James Merkel | May 25, 22:14 | |
| Kyle Sluder | May 26, 03:41 | |
| Scott Anguish | May 26, 08:21 | |
| Uli Kusterer | May 26, 09:54 | |
| Uli Kusterer | May 26, 10:17 | |
| Quincey Morris | May 26, 19:49 | |
| dream cat7 | May 27, 03:24 | |
| Andreas Mayer | May 27, 05:34 | |
| Scott Ribe | May 27, 06:24 | |
| Hamish Allan | May 27, 11:11 | |
| Andy Lee | May 27, 14:34 | |
| Andy Lee | May 27, 14:48 | |
| Kyle Sluder | May 27, 15:52 | |
| Andy Lee | May 27, 16:06 | |
| Mike Abdullah | May 27, 17:51 | |
| Andy Lee | May 27, 19:36 | |
| Quincey Morris | May 27, 20:02 | |
| Andy Lee | May 27, 20:50 | |
| Quincey Morris | May 27, 22:40 | |
| Ken Thomases | May 27, 22:47 | |
| Andy Lee | May 27, 23:04 | |
| Alex Kac | May 27, 23:19 | |
| Gary L. Wade | May 27, 23:55 | |
| Scott Anguish | May 28, 00:13 |






Cocoa mail archive

