Re: Constant NSArray Count
Re: Constant NSArray Count
- Subject: Re: Constant NSArray Count
- From: Alex Mills <email@hidden>
- Date: Sat, 20 Sep 2008 18:53:23 +0800
Hey,
Yeah I have been reading through a bit of it. At the moment I have an
NSArrayController setup in IB to access a Core Data Entity. A table
view is then connected to that Array Controller to display the
contents of it. This is all done without any code written by myself so
I'm pretty new to working with these objects programatically. I need
code that will recognize when the selection count of my table view
changes, if that count is 0 it will display tab 1, if the selection
count is 1 or more it will display tab 2. Right now I have an IBAction
that will do this but requires me to press a button for the count
check to be performed, what do you think would be the best way to
implement this idea?
This is the IBAction:
-(IBAction)checkCount: sender;
{
NSArray *selectedObjects = [propertyTableController selectedObjects];
NSUInteger count = [selectedObjects count];
if (count == 0)
{
[newTabView selectTabViewItemWithIdentifier:@"2"];
}
else
{
[newTabView selectTabViewItemWithIdentifier:@"1"];
}
return;
}
Cheers
Alex Mills
On Sep 20, 2008, at 5:41 PM, Jason Coco wrote:
On Sep 20, 2008, at 05:05 , Alex Mills wrote:
Hey,
I have started looking at Key Value Observing but I'm having
trouble working out how to observe the changes within an Array.
Is there some place I can find example code on this to help wrap my
head around it?
I'm pretty sure that you can't do KVO directly on arrays, just on
the relationships that the array holds, but to get started, here is
a link to the Key-Value Observing guide from Apple:
http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html#/
/apple_ref/doc/uid/10000177
You might also want to do a full-text search for KVO and Key-Value
Observing in the search window in Xcode.
HTH, Jason
_______________________________________________
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