• 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
binding to struct
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

binding to struct


  • Subject: binding to struct
  • From: "ad veloper" <email@hidden>
  • Date: Tue, 11 Sep 2007 20:56:21 +0100

My View class has a number of structs which I'd like to bind to. I garbled
mmalc's example which is discussed here:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/HowDoBindingsWork.html,
and managed to get things running with one of my struct.properties. However,
I am a little perturbed by the amount of code I'm having to write in order
to establish bindings with the number of attributes that I have. Is this
just par for the course, or am I missing something?

As it stands it is much simpler to use an arraycontroller to manage the
Model and get the current selection from it and manipulate the
valueForKeyPath's in the model directly and eliminate the structs
altogether, but then this seems to shunt the model too far up into the view
violating MVC, as well as making changes to values tedious in the extreme
with endless reams of:

float x = [[modelObject valueForKeyPath:@"vector.x"] floatValue];
x+=1;
[[modelObject setValue:[NSNumber numberWithFloat:x] forKeyPath:@"vector.x"];

type code, rather than a rather more straightforward as per mmalc's
examples:

vector.x+=1;

Lesser of two evils or am I doing something wrong?
_______________________________________________

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: [ANN] RegexKit - An Objective-C Framework for Regular Expressions Using the PCRE Library
  • Next by Date: Quartz Comp and Audio input??
  • Previous by thread: Re: DistantObject, NSConnection, NSPortCoder Exception
  • Next by thread: Quartz Comp and Audio input??
  • Index(es):
    • Date
    • Thread