Re: Maintaining NSCursor outside of app window

2011-01-14 Thread Uli Kusterer
On 14.01.2011, at 01:37, Corbin Dunn wrote:
> - (void)draggedImage:(NSImage *)draggedImage movedTo:(NSPoint)screenPoint
> 
> Then do something like this (after converting the screen point to window 
> coords):
> 
>NSPoint windowPoint = [[view window] mouseLocationOutsideOfEventStream];
>NSPoint localPoint = [view convertPoint:windowPoint fromView:nil];

 The OS will be very disappointed if it hands you a screenPoint and you just 
completely ignore it and use mouseLocationOutsideOfEventStream instead. Due to 
lag, CPU load etc. It sounds like a better idea to use the parameter.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Overriding target and action of backBarButtonItem

2011-01-14 Thread charisse napeÿfffff1as
Hello Guys,

I have trouble setting the action for my backbarbutton item. No matter how I 
set 
it, my selector does not get called.
Here is my code below:


UIBarButtonItem *backB = [[UIBarButtonItem alloc] init];
backB.title = @"Back";
backB.action = @selector(disconnect:);
self.navigationItem.backBarButtonItem = backB;
[backB release];

Assume I created a disconnect() function already.

But if I use leftBarButtonItem my function gets called. Is this because the 
backBarButton item already has its function to dismiss the view? Can't I 
override it somehow?


Thanks,
Charisse



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: sending a message from an initializer method

2011-01-14 Thread Andreas Grosam

On Jan 14, 2011, at 1:29 AM, Richard Somers wrote:

> I often will do something like this.
> 
> - (id)init
> {
> self = [super init];
> if (self) {
> [self prepare...];
> [self prepare...];
> [self prepare...];
> // etc...
> }
> return self;
> }
> 
> The methods 'prepare...' are all private methods. The preparation code for 
> one of my classes is over 300 lines with five individual prepare methods. 
> Breaking it up like this keeps it organized, understandable, and aids in 
> debugging and refactoring. It works very well.

unless a subclass accidentally overrides -prepareX:   ...

The ubiquitousness of polymorphic methods and the lack of visibility rules in 
the runtime may make initializing of objects cumbersome, error prone and 
fragile.
So, just be careful.

If you don't want to have subclasses accidentally override your methods, you 
may want to prefix them:

@interface MyClass (Private)  {
-(void) MyClass_init();
-(void) MyClass_foo:(id x);
}

- (void) awakeFromNib {
[self MyClass_init];
}
- (id) init {
self = [super init];
if (self) {
[MyClass_init];
}
return self;
}

Though, there is no guarantee.


Regards
Andreas___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Mutable to-many relationship not observable

2011-01-14 Thread Remco Poelstra
Hi,

I've a property digiDevices that's a to-many relationship. I've implemented the 
value write accesors (in addition to the read ones, which behave perfect):
- (void) insertObject:(DigiDevice *)digiDevice 
inDigiDevicesAtIndex:(NSUInteger)index {
[digiDevices insertObject:digiDevice atIndex:index];
}

- (void) removeObjectFromDigiDevicesAtIndex:(NSUInteger)index {
[digiDevices removeObjectAtIndex:index];
}

When I modify the relationship through mutableArrayValueForKey: the object is 
correctly removed, but no notification is send to objects observing the array. 
The KVC Guide states that I get automatic KVO by implementing these methods.
Is there something I did wrong?

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Determining whether a dictionary is mutable or not

2011-01-14 Thread Tito Ciuro
Hello,

Trying to determine whether an NSDictionary is mutable or not fails with these 
two tests:

// Variable info could be NSDictionary or NSMutableDictionary. Assume it's an 
NSDictionary.

BOOL isKindOfClass = [info isKindOfClass:[NSMutableDictionary class]];
BOOL respondsToSelector = [info 
respondsToSelector:@selector(setObject:forKey:)];

After executing the above statements, both variables 'isKindOfClass' 
and'respondsToSelector' are set to YES.

When I obtain the class type of 'info', I get:

(gdb) po [info class]
NSCFDictionary

The question is: if 'info' is an immutable dictionary, why is isKindOfClass and 
respondsToSelector telling me that it is mutable?

Thanks,

-- Tito
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mutable to-many relationship not observable

2011-01-14 Thread Mike Abdullah
Show us your code that adds the observer. Also, what is the superclass of this 
class?

On 14 Jan 2011, at 10:45, Remco Poelstra wrote:

> Hi,
> 
> I've a property digiDevices that's a to-many relationship. I've implemented 
> the value write accesors (in addition to the read ones, which behave perfect):
> - (void) insertObject:(DigiDevice *)digiDevice 
> inDigiDevicesAtIndex:(NSUInteger)index {
>   [digiDevices insertObject:digiDevice atIndex:index];
> }
> 
> - (void) removeObjectFromDigiDevicesAtIndex:(NSUInteger)index {
>   [digiDevices removeObjectAtIndex:index];
> }
> 
> When I modify the relationship through mutableArrayValueForKey: the object is 
> correctly removed, but no notification is send to objects observing the 
> array. The KVC Guide states that I get automatic KVO by implementing these 
> methods.
> Is there something I did wrong?
> 
> Kind regards,
> 
> Remco Poelstra
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Mike Abdullah
If you want to test if a dictionary is immutable, you are almost certainly 
doing it wrong. When passed a dictionary in to a method either:

A) Make a mutable copy if that's what you need
B) -copy it if you want it to be immutable. (This is not inefficient as it 
sounds because immutable objects implement -copy to do a -retain and return 
self instead)

On 14 Jan 2011, at 10:48, Tito Ciuro wrote:

> Hello,
> 
> Trying to determine whether an NSDictionary is mutable or not fails with 
> these two tests:
> 
> // Variable info could be NSDictionary or NSMutableDictionary. Assume it's an 
> NSDictionary.
> 
> BOOL isKindOfClass = [info isKindOfClass:[NSMutableDictionary class]];
> BOOL respondsToSelector = [info 
> respondsToSelector:@selector(setObject:forKey:)];
> 
> After executing the above statements, both variables 'isKindOfClass' 
> and'respondsToSelector' are set to YES.
> 
> When I obtain the class type of 'info', I get:
> 
> (gdb) po [info class]
> NSCFDictionary
> 
> The question is: if 'info' is an immutable dictionary, why is isKindOfClass 
> and respondsToSelector telling me that it is mutable?
> 
> Thanks,
> 
> -- Tito
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mutable to-many relationship not observable

2011-01-14 Thread Remco Poelstra
Hi,

I add the observer as follows:
[[DigiDevicesManager sharedDigiDevicesManager] addObserver:self 
forKeyPath:@"digiDevices" options:NSKeyValueObservingOptionOld context:nil];
It's superclass is NSObject and I did not disable automatic notifications.

If mutate the array (from inside the observed object) with [self 
{will/did}change..] then everything works fine.

Regards,

Remco Poelstra

Op 14 jan 2011, om 12:11 heeft Mike Abdullah het volgende geschreven:

> Show us your code that adds the observer. Also, what is the superclass of 
> this class?
> 
> On 14 Jan 2011, at 10:45, Remco Poelstra wrote:
> 
>> Hi,
>> 
>> I've a property digiDevices that's a to-many relationship. I've implemented 
>> the value write accesors (in addition to the read ones, which behave 
>> perfect):
>> - (void) insertObject:(DigiDevice *)digiDevice 
>> inDigiDevicesAtIndex:(NSUInteger)index {
>>  [digiDevices insertObject:digiDevice atIndex:index];
>> }
>> 
>> - (void) removeObjectFromDigiDevicesAtIndex:(NSUInteger)index {
>>  [digiDevices removeObjectAtIndex:index];
>> }
>> 
>> When I modify the relationship through mutableArrayValueForKey: the object 
>> is correctly removed, but no notification is send to objects observing the 
>> array. The KVC Guide states that I get automatic KVO by implementing these 
>> methods.
>> Is there something I did wrong?
>> 
>> Kind regards,
>> 
>> Remco Poelstra
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
>> 
>> This email sent to cocoa...@mikeabdullah.net
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Tito Ciuro
Hi Mike,

Given that the caller can pass a NSDictionary or an NSMutableDictionary, I 
wanted to test its mutability before calling setObject:forKey:. In order to 
avoid calling mutableCopy each time, I thought it would be more efficient to 
test it and then call mutableCopy only when needed.

Thanks for the help,

-- Tito

On Jan 14, 2011, at 12:15 PM, Mike Abdullah wrote:

> If you want to test if a dictionary is immutable, you are almost certainly 
> doing it wrong. When passed a dictionary in to a method either:
> 
> A) Make a mutable copy if that's what you need
> B) -copy it if you want it to be immutable. (This is not inefficient as it 
> sounds because immutable objects implement -copy to do a -retain and return 
> self instead)
> 
> On 14 Jan 2011, at 10:48, Tito Ciuro wrote:
> 
>> Hello,
>> 
>> Trying to determine whether an NSDictionary is mutable or not fails with 
>> these two tests:
>> 
>> // Variable info could be NSDictionary or NSMutableDictionary. Assume it's 
>> an NSDictionary.
>> 
>> BOOL isKindOfClass = [info isKindOfClass:[NSMutableDictionary class]];
>> BOOL respondsToSelector = [info 
>> respondsToSelector:@selector(setObject:forKey:)];
>> 
>> After executing the above statements, both variables 'isKindOfClass' 
>> and'respondsToSelector' are set to YES.
>> 
>> When I obtain the class type of 'info', I get:
>> 
>> (gdb) po [info class]
>> NSCFDictionary
>> 
>> The question is: if 'info' is an immutable dictionary, why is isKindOfClass 
>> and respondsToSelector telling me that it is mutable?
>> 
>> Thanks,
>> 
>> -- Tito
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
>> 
>> This email sent to cocoa...@mikeabdullah.net
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread jonat...@mugginsoft.com

On 14 Jan 2011, at 10:48, Tito Ciuro wrote:

> Hello,
> 
> Trying to determine whether an NSDictionary is mutable or not fails with 
> these two tests:
> 
> // Variable info could be NSDictionary or NSMutableDictionary. Assume it's an 
> NSDictionary.
> 
> BOOL isKindOfClass = [info isKindOfClass:[NSMutableDictionary class]];
> BOOL respondsToSelector = [info 
> respondsToSelector:@selector(setObject:forKey:)];
> 
> After executing the above statements, both variables 'isKindOfClass' 
> and'respondsToSelector' are set to YES.
> 
> When I obtain the class type of 'info', I get:
> 
> (gdb) po [info class]
> NSCFDictionary
> 
> The question is: if 'info' is an immutable dictionary, why is isKindOfClass 
> and respondsToSelector telling me that it is mutable?
> 

The following thread discusses the above and the logic that causes it to be so:

http://lists.apple.com/archives/cocoa-dev/2008/Dec/msg00649.html

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread jonat...@mugginsoft.com


On 14 Jan 2011, at 11:25, Tito Ciuro wrote:

> Hi Mike,
> 
> Given that the caller can pass a NSDictionary or an NSMutableDictionary, I 
> wanted to test its mutability before calling setObject:forKey:. In order to 
> avoid calling mutableCopy each time, I thought it would be more efficient to 
> test it and then call mutableCopy only when needed.
> 
> Thanks for the help,
> 
> -- Tito
> 
> 


In this case just check if your object responds to setObject:forKey:
If it does its mutable, if not it isn't.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Roland King

On 14-Jan-2011, at 7:25 PM, Tito Ciuro wrote:

> Hi Mike,
> 
> Given that the caller can pass a NSDictionary or an NSMutableDictionary, I 
> wanted to test its mutability before calling setObject:forKey:. In order to 
> avoid calling mutableCopy each time, I thought it would be more efficient to 
> test it and then call mutableCopy only when needed.
> 
> Thanks for the help,
> 
> -- Tito
> 

remember - write it first, optimize it later. If your app is slow and you run 
the performance tools on it and making mutable copies is what's causing you 
performance issues then by all means optimize it at that point. My suspicion 
would be that making mutable copies of existing dictionaries is a pretty fast 
operation, apple's pretty good at that stuff. 

One other idea, if your method wants a dictionary it can mutate, how about 
making that the signature and making it up to the caller to send something 
mutable, as it seems not entirely unlikely the caller knows what it has. 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Tito Ciuro
Hi Jonathan,

On Jan 14, 2011, at 12:34 PM, jonat...@mugginsoft.com wrote:

> On 14 Jan 2011, at 11:25, Tito Ciuro wrote:
> 
>> Hi Mike,
>> 
>> Given that the caller can pass a NSDictionary or an NSMutableDictionary, I 
>> wanted to test its mutability before calling setObject:forKey:. In order to 
>> avoid calling mutableCopy each time, I thought it would be more efficient to 
>> test it and then call mutableCopy only when needed.
>> 
>> Thanks for the help,
>> 
>> -- Tito
>> 
>> 
> 
> 
> In this case just check if your object responds to setObject:forKey:
> If it does its mutable, if not it isn't.

But that's the problem: it always returns YES, even when it's an immutable 
dictionary.

-- Tito
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Roland King

On 14-Jan-2011, at 7:36 PM, Roland King wrote:

> 
> On 14-Jan-2011, at 7:25 PM, Tito Ciuro wrote:
> 
>> Hi Mike,
>> 
>> Given that the caller can pass a NSDictionary or an NSMutableDictionary, I 
>> wanted to test its mutability before calling setObject:forKey:. In order to 
>> avoid calling mutableCopy each time, I thought it would be more efficient to 
>> test it and then call mutableCopy only when needed.
>> 
>> Thanks for the help,
>> 
>> -- Tito
>> 
> 
> remember - write it first, optimize it later. If your app is slow and you run 
> the performance tools on it and making mutable copies is what's causing you 
> performance issues then by all means optimize it at that point. My suspicion 
> would be that making mutable copies of existing dictionaries is a pretty fast 
> operation, apple's pretty good at that stuff. 
> 
> One other idea, if your method wants a dictionary it can mutate, how about 
> making that the signature and making it up to the caller to send something 
> mutable, as it seems not entirely unlikely the caller knows what it has. 
> 

Hit send too fast .. 

Also, if your caller can pass NSDictionary or NSMutableDictionary to your 
method that seems to indicate the method signature is .. NSDictionary. If I as 
a caller send something to a method which takes an NSDictionary, I would expect 
you not to mutate it, even if I happen to have sent you a mutable one. So 
either change the signature to be NSMutableDictionary, and if callers don't 
want you mutating the argument they can copy it before they send it you, or 
make a mutable copy of the argument for yourself every time and respect the 
method calling signature. 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Clark Cox
On Fri, Jan 14, 2011 at 3:34 AM, jonat...@mugginsoft.com
 wrote:
>
>
> On 14 Jan 2011, at 11:25, Tito Ciuro wrote:
>
>> Hi Mike,
>>
>> Given that the caller can pass a NSDictionary or an NSMutableDictionary, I 
>> wanted to test its mutability before calling setObject:forKey:. In order to 
>> avoid calling mutableCopy each time, I thought it would be more efficient to 
>> test it and then call mutableCopy only when needed.
>>
>> Thanks for the help,
>>
>> -- Tito
>>
>
> In this case just check if your object responds to setObject:forKey:
> If it does its mutable, if not it isn't.

Unfortunately, that will not work. Internally, both NSDictionary and
NSMutableDictionary are implemented by the same class; even
NSDictionary responds to -setObject:forKey: (it won't do much other
than throw an exception if called, but it implements it nonetheless)

-- 
Clark S. Cox III
clarkc...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread jonat...@mugginsoft.com
On 14 Jan 2011, at 11:43, Clark Cox wrote:

> On Fri, Jan 14, 2011 at 3:34 AM, jonat...@mugginsoft.com
>  wrote:
>> 
>> 
>> On 14 Jan 2011, at 11:25, Tito Ciuro wrote:
>> 
>>> Hi Mike,
>>> 
>>> Given that the caller can pass a NSDictionary or an NSMutableDictionary, I 
>>> wanted to test its mutability before calling setObject:forKey:. In order to 
>>> avoid calling mutableCopy each time, I thought it would be more efficient 
>>> to test it and then call mutableCopy only when needed.
>>> 
>>> Thanks for the help,
>>> 
>>> -- Tito
>>> 
>> 
>> In this case just check if your object responds to setObject:forKey:
>> If it does its mutable, if not it isn't.
> 
> Unfortunately, that will not work. Internally, both NSDictionary and
> NSMutableDictionary are implemented by the same class; even
> NSDictionary responds to -setObject:forKey: (it won't do much other
> than throw an exception if called, but it implements it nonetheless)
> 

You are quite correct. I had forgotten the detail of this. Apologies.

Apple's take on this is to choose a method signature and stick to it.

You can, however, dig the mutability info out if you really want to.
You can use -classForCoder and that will give you either NSDictionary
or NSMutableDictionary.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Tito Ciuro
Hi Pablo,

On Jan 14, 2011, at 1:35 PM, Pablo Pons Bordes wrote:

> Hello,
> 
> To determine if a dictionary is mutable or Inmutable you just need to use the 
> isKindOfClass method, instead of use respondsToSelector.
> 
> I did a test to reproduce your problem and couldn't reproduce your problem, 
> so my conclusion is that actually you are receiving a mutable Dictionary when 
> you think is unMutable 

Hm. No, I'm not getting a mutable dictionary because I'm seeing a log message 
complaining that I'm trying to call setObject:forKey: on an immutable object.

Thanks!

-- Tito
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Pablo Pons Bordes
Hello,

To determine if a dictionary is mutable or Inmutable you just need to use the 
isKindOfClass method, instead of use respondsToSelector.

I did a test to reproduce your problem and couldn't reproduce your problem, so 
my conclusion is that actually you are receiving a mutable Dictionary when you 
think is unMutable 


I hope it helps you.


NSDictionary*unmutableDictionary;
NSMutableDictionary *mutableDictionary;
NSDictionary*testDictionary;
Class   ummutableClass;
Class   mutableClass;

ummutableClass = [NSDictionary  class];
mutableClass = [NSMutableDictionary class];

unmutableDictionary = [NSDictionary dictionary];
mutableDictionary   = [NSMutableDictionary  dictionary];

/**
 To test the situation where the function input parameter is a 
NSDictionary and be able
 to detect if the passed object is mutable or unmutable we use the 
testDictionary as "input parameter"
 */


/**
 An Inmutable dictionary shoud only be Inmutable Class
 */
//TEST Inmutable Dictionary
testDictionary = unmutableDictionary;
if ([testDictionary isKindOfClass: ummutableClass] == YES) {
NSLog(@"Test %d.%@ OK", 1,@"A");
} else {
NSLog (@"Test %d.%@ ERROR", 1,@"A");
}

if ([testDictionary isKindOfClass: mutableClass] == NO) {
NSLog(@"Test %d.%@ OK", 1,@"B");
} else {
NSLog (@"Test %d.%@ ERROR", 1,@"B");
}

if ([testDictionary respondsToSelector:@selector(setObject:forKey:)] == 
NO) {
NSLog(@"Test %d.%@ OK", 1,@"C");
} else {
NSLog (@"Test %d.%@ ERROR", 1,@"C");
}

/**
 A Mutable dictionary shoud be from both classes (Mutable and inmutable)
 */ 
//Test Mutable Dictionary
testDictionary = mutableDictionary;
if ([testDictionary isKindOfClass: ummutableClass] == YES) {
NSLog(@"Test %d.%@ OK", 2,@"A");
} else {
NSLog (@"Test %d.%@ ERROR", 2,@"A");
}

if ([testDictionary isKindOfClass: mutableClass] == YES) {
NSLog(@"Test %d.%@ OK", 2,@"B");
} else {
NSLog (@"Test %d.%@ ERROR", 2,@"B");
}

if ([testDictionary respondsToSelector:@selector(setObject:forKey:)] == 
YES) {
NSLog(@"Test %d.%@ OK", 2,@"C");
} else {
NSLog (@"Test %d.%@ ERROR", 2,@"C");
}


OUTPUT:

2011-01-14 12:31:31.970 Dictionary TEST[2672:207] Test 1.A OK
2011-01-14 12:31:31.972 Dictionary TEST[2672:207] Test 1.B OK
2011-01-14 12:31:31.973 Dictionary TEST[2672:207] Test 1.C OK
2011-01-14 12:31:31.988 Dictionary TEST[2672:207] Test 2.A OK
2011-01-14 12:31:31.994 Dictionary TEST[2672:207] Test 2.B OK
2011-01-14 12:31:31.994 Dictionary TEST[2672:207] Test 2.C 
OK___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Core Data one to many insert question

2011-01-14 Thread Philip Vallone

Hi List,

I have an Entity called "CDSites" which has a one-to-many relationship with an 
Entity called "CDPlacemarks". CDSites is the "Parent" and CDPlacemarks are the 
"Children". My Applications allows the users to create many CDSites like this:


CDSites *cdSites = [NSEntityDescription 
insertNewObjectForEntityForName:@"CDSites" inManagedObjectContext:context];
cdSites.prjName = self.newDetailsView.prjName;
cdSites.street = self.newDetailsView.street;
cdSites.city = self.newDetailsView.city;
cdSites.state = self.newDetailsView.prjState;
cdSites.zip = self.newDetailsView.zip;  
cdSites.latitude  = [NSNumber 
numberWithFloat:self.newDetailsView.latitude];
cdSites.longitude = [NSNumber 
numberWithFloat:self.newDetailsView.longitude];


NSError *error;
if (![context save:&error]) {
NSLog(@"Couldn't save: %@", [error localizedDescription]);
}


CDSites is a subclass of NSManagedObject.

This works well. My question is, I need to create the CDPlacemarks for each 
CDSite. How do I associate my CDPlacemarks with its "Parent" CDSites?

Thanks for the help.

Phil



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Pablo Pons Bordes
So why I'm not able to reproduce your problem? There is three posible case:

1.- I maid wrong the Test.
2.- You are making wrong "If" statement (maybe an assignment instead of compare 
)
3.- Something really estrange happens.

good luck
Pablo




El 14/01/2011, a las 12:44, Tito Ciuro escribió:

> Hi Pablo,
> 
> On Jan 14, 2011, at 1:35 PM, Pablo Pons Bordes wrote:
> 
>> Hello,
>> 
>> To determine if a dictionary is mutable or Inmutable you just need to use 
>> the isKindOfClass method, instead of use respondsToSelector.
>> 
>> I did a test to reproduce your problem and couldn't reproduce your problem, 
>> so my conclusion is that actually you are receiving a mutable Dictionary 
>> when you think is unMutable 
> 
> Hm. No, I'm not getting a mutable dictionary because I'm seeing a log message 
> complaining that I'm trying to call setObject:forKey: on an immutable object.
> 
> Thanks!
> 
> -- Tito

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Roland King

On 14-Jan-2011, at 8:44 PM, Tito Ciuro wrote:

> Hi Pablo,
> 
> On Jan 14, 2011, at 1:35 PM, Pablo Pons Bordes wrote:
> 
>> Hello,
>> 
>> To determine if a dictionary is mutable or Inmutable you just need to use 
>> the isKindOfClass method, instead of use respondsToSelector.
>> 
>> I did a test to reproduce your problem and couldn't reproduce your problem, 
>> so my conclusion is that actually you are receiving a mutable Dictionary 
>> when you think is unMutable 
> 
> Hm. No, I'm not getting a mutable dictionary because I'm seeing a log message 
> complaining that I'm trying to call setObject:forKey: on an immutable object.
> 
> Thanks!
> 
> -- Tito

Again let me say that if the signature to your method is 

-(void)doSomethingWithADictionary:(NSDictionary*)dictionary;

you shouldn't be trying to figure out whether that dictionary is mutable and 
mutate it. Any caller has at least a reasonable expectation (if not an absolute 
right) to assume that the method is expecting something it cannot mutate and 
will not try mutating it. If you wish to mutate that argument, you must make a 
mutable copy of it and leave the thing the caller sent you intact. 

If you want it to be otherwise make the signature 


-(void)doSomethingWithADictionaryICanReallyMessUpForYou:(NSMutableDictionary*)dictionary

and make all the callers send mutable objects they know they don't need later 
and which they are forewarned you may be messing about with. 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data one to many insert question

2011-01-14 Thread Pablo Pons Bordes
You need to declare some method that core date implement for you, for this 
situations, to make your life easier XCode help you to declare it and declare 
those custom class file declarations:

- At your Core Date model select the entities you want to make a custom class.
- go to Menu File>New File...
- At Cocoa Class or (Cocoa Touch Class, depend what you are doing) you find a 
New File Type, Managed Object Class.
- Select it and create the classes.

Then you will see is really easy.

NOTE: When you do this the old implementation you have will me deleted, 
refactor it before you make the classes if you don't want to lost what you did 
before.

Pablo Pons


  



El 14/01/2011, a las 12:53, Philip Vallone escribió:

> 
> Hi List,
> 
> I have an Entity called "CDSites" which has a one-to-many relationship with 
> an Entity called "CDPlacemarks". CDSites is the "Parent" and CDPlacemarks are 
> the "Children". My Applications allows the users to create many CDSites like 
> this:
> 
> 
>   CDSites *cdSites = [NSEntityDescription 
> insertNewObjectForEntityForName:@"CDSites" inManagedObjectContext:context];
>   cdSites.prjName = self.newDetailsView.prjName;
>   cdSites.street = self.newDetailsView.street;
>   cdSites.city = self.newDetailsView.city;
>   cdSites.state = self.newDetailsView.prjState;
>   cdSites.zip = self.newDetailsView.zip;  
>   cdSites.latitude  = [NSNumber 
> numberWithFloat:self.newDetailsView.latitude];
>   cdSites.longitude = [NSNumber 
> numberWithFloat:self.newDetailsView.longitude];
>   
>   
>   NSError *error;
>   if (![context save:&error]) {
>   NSLog(@"Couldn't save: %@", [error localizedDescription]);
>   }
> 
> 
> CDSites is a subclass of NSManagedObject.
> 
> This works well. My question is, I need to create the CDPlacemarks for each 
> CDSite. How do I associate my CDPlacemarks with its "Parent" CDSites?
> 
> Thanks for the help.
> 
> Phil
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/pablo.mailinglists%40gmail.com
> 
> This email sent to pablo.mailingli...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data one to many insert question

2011-01-14 Thread Philip Vallone
Thanks. I had used X-code to create the subclasses. I see that it created the 
required methods for adding the "children". Thanks for the help. If I have any 
issues, I'll post a new question. 

Regards,

Phil

On Jan 14, 2011, at 8:07 AM, Pablo Pons Bordes  
wrote:

> You need to declare some method that core date implement for you, for this 
> situations, to make your life easier XCode help you to declare it and declare 
> those custom class file declarations:
> 
> - At your Core Date model select the entities you want to make a custom class.
> - go to Menu File>New File...
> - At Cocoa Class or (Cocoa Touch Class, depend what you are doing) you find a 
> New File Type, Managed Object Class.
> - Select it and create the classes.
> 
> Then you will see is really easy.
> 
> NOTE: When you do this the old implementation you have will me deleted, 
> refactor it before you make the classes if you don't want to lost what you 
> did before.
> 
> Pablo Pons
> 
> 
> 
> 
> 
> 
> El 14/01/2011, a las 12:53, Philip Vallone escribió:
> 
>> 
>> Hi List,
>> 
>> I have an Entity called "CDSites" which has a one-to-many relationship with 
>> an Entity called "CDPlacemarks". CDSites is the "Parent" and CDPlacemarks 
>> are the "Children". My Applications allows the users to create many CDSites 
>> like this:
>> 
>> 
>>CDSites *cdSites = [NSEntityDescription 
>> insertNewObjectForEntityForName:@"CDSites" inManagedObjectContext:context];
>>cdSites.prjName = self.newDetailsView.prjName;
>>cdSites.street = self.newDetailsView.street;
>>cdSites.city = self.newDetailsView.city;
>>cdSites.state = self.newDetailsView.prjState;
>>cdSites.zip = self.newDetailsView.zip;
>>cdSites.latitude  = [NSNumber 
>> numberWithFloat:self.newDetailsView.latitude];
>>cdSites.longitude = [NSNumber 
>> numberWithFloat:self.newDetailsView.longitude];
>>
>>
>>NSError *error;
>>if (![context save:&error]) {
>>NSLog(@"Couldn't save: %@", [error localizedDescription]);
>>}
>> 
>> 
>> CDSites is a subclass of NSManagedObject.
>> 
>> This works well. My question is, I need to create the CDPlacemarks for each 
>> CDSite. How do I associate my CDPlacemarks with its "Parent" CDSites?
>> 
>> Thanks for the help.
>> 
>> Phil
>> 
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/pablo.mailinglists%40gmail.com
>> 
>> This email sent to pablo.mailingli...@gmail.com
> 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: data over USB to iPhone

2011-01-14 Thread Thomas Engelmeier

On 13.01.2011, at 20:19, Kyle Sluder wrote:

> On Thu, Jan 13, 2011 at 11:12 AM, Reaves, Timothy
>  wrote:
>> That's not correct.  There are Apple approved cables to allow you to do
>> exactly that (there is a serial cable too).  But my understanding is the
>> cable itself is not certified by Apple, but the actual usage of the cable.
>> You you can get one of the existing cables and see if you can use it for
>> your purpose, or contact the cable manufacturer, and see what they would
>> charge to provide cables to you that are certified by Apple.
> 
> Are these cables part of the Made for iPhone program?
> 
> Aside from USB audio and keyboards, there's no out-of-the-box support
> for communicating over USB with the iOS SDK.

iPad iOS is able to work as an USB host for:

- MTP devices
- Mass Storage Devices

If you want to ship an app using that feature, filing an bug reports / feature 
request to "de-private" ImageCapture.framework makes sense ;-)


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


array contents and objects

2011-01-14 Thread Amy Heavey
I've got a core data app that has 2 entities, product and status, and  
a relationship between them.


I'll be importing and updating some of the data in the app from csv  
files supplied from an outside source. The 'status' is just given as a  
string. There are 3 options, Low Stock, Out of Stock, and In Stock.


As I import, I can create new products, and set the attributes, and I  
think I know how to set the relationship once the status is defined,  
but I need to select it first.


I'm looking for something that does something like

[status selectObjectWithValue:@"Low Stock"]

or do I need to loop through the array each time. It's only a few but  
seems excessive to loop through it?


Many Thanks

Amy



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: array contents and objects

2011-01-14 Thread Pablo Pons Bordes
I recommend you to read "Core Data Programming Guide" from Apple Developer web 
site.

And go to "Fetching Managed Objects" this is a very important document you must 
have if you want to develop with core data.

What you will do is to perform a request with a predicate like 
NSPredicate * aPredicate = [NSPredicate predicateWithFormat: @"status == %@", 
statusToFind];

I also recommend you to search at the WWDC10 videos with "core Data" tag, there 
are also very good videos, where you can learn a lot of thing really fast.

My last recommendation is you store the status as Integer and set Index On, it 
will be much faster for core date to fetch the objects, 
Out of Stock = 1,
Low Stock = 2
In Stock = 3,

Good luck, 

Pablo
 

 
El 14/01/2011, a las 14:35, Amy Heavey escribió:

> I've got a core data app that has 2 entities, product and status, and a 
> relationship between them.
> 
> I'll be importing and updating some of the data in the app from csv files 
> supplied from an outside source. The 'status' is just given as a string. 
> There are 3 options, Low Stock, Out of Stock, and In Stock.
> 
> As I import, I can create new products, and set the attributes, and I think I 
> know how to set the relationship once the status is defined, but I need to 
> select it first.
> 
> I'm looking for something that does something like
> 
> [status selectObjectWithValue:@"Low Stock"]
> 
> or do I need to loop through the array each time. It's only a few but seems 
> excessive to loop through it?
> 
> Many Thanks
> 
> Amy
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/pablo.mailinglists%40gmail.com
> 
> This email sent to pablo.mailingli...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Overriding target and action of backBarButtonItem

2011-01-14 Thread Matt Neuburg
On Fri, 14 Jan 2011 01:17:58 -0800 (PST), charisse nape?f1as 
 said:
>Hello Guys,
>
>I have trouble setting the action for my backbarbutton item. No matter how I 
>set 
>it, my selector does not get called.
>Here is my code below:
>
>
>UIBarButtonItem *backB = [[UIBarButtonItem alloc] init];
>backB.title = @"Back";
>backB.action = @selector(disconnect:);
>   self.navigationItem.backBarButtonItem = backB;
>   [backB release];
>
>Assume I created a disconnect() function already.
>
>But if I use leftBarButtonItem my function gets called. Is this because the 
>backBarButton item already has its function to dismiss the view? Can't I 
>override it somehow?

No, you really can't. A backBarButton item should have a nil select and target, 
allowing it to perform its standard function, namely to go back. However, you 
can perform other trickery that allows you to customize what happens at that 
moment. You can change beforehand what the user will go back *to*, and you can 
hear through a notification when the user does go back. Any further advice 
would depend upon your explaining what you are really trying to accomplish. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIEvent timestamp clarification

2011-01-14 Thread Matt Neuburg
On Wed, 12 Jan 2011 18:36:56 -0500, Andrew Coad  said:
>
>Reading through the docs, the approximate flow from a user touching an 
>interface component (e.g. a button) to the touch event being processed by the 
>application is:
>
> - User touches (e.g. a UIButton), a "touch" object is created and enqueued on 
> the dispatch thread (main thread)
> - The touch object is dequeued, a UIEvent object is created and dispatched to 
> the target object (for handling)
>
>The docs also state that the timestamp of the UIEvent [event timestamp] is the 
>time that the event was created.  From this I assume that [event timestamp] is 
>somewhat later than the actual time that user touched the UIButton - how much 
>later depends on system activity around that time.  Is this assumption 
>correct? If so, is there a way to get the time that the user touched the 
>interface?  The small number (indeterminate) of milliseconds lag between touch 
>time and event time is important to me.  I can tolerate processing the event 
>after an indeterminate lag but I do need to know when the actual touch 
>occurred.

The problem is that the timestamp on the UIEvent is as close to "when the 
actual touch occurred" as you're going to get - regardless of what it may 
really indicate. The actual touch is reported to your app from outside the app, 
i.e. by the system. The system surely puts a timestamp on that report, and that 
timestamp is probably reproduced as the timestamp on the UIEvent, in which case 
you are worrying needlessly. But if that timestamp is NOT the timestamp on the 
UIEvent, you can't access it, so you are still worrying needlessly. :) m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Andy Lee

On Jan 14, 2011, at 7:57 AM, Roland King wrote:
> Again let me say that if the signature to your method is 
> 
>   -(void)doSomethingWithADictionary:(NSDictionary*)dictionary;
> 
> you shouldn't be trying to figure out whether that dictionary is mutable and 
> mutate it.

Yup.

> If you want it to be otherwise make the signature 
> 
>   
> -(void)doSomethingWithADictionaryICanReallyMessUpForYou:(NSMutableDictionary*)dictionary
> 
> and make all the callers send mutable objects they know they don't need later 
> and which they are forewarned you may be messing about with.

I suggest letting the caller tell you what kind of dictionary it is sending.  
Have two different methods:

-(void)doSomethingWithADictionary:(NSDictionary*)dictionary;
-(void)doSomethingWithAMutableDictionary:(NSMutableDictionary*)dictionary;

Have each of these call a private method that does the real work:

-(void)_privatelyDoSomethingWithAPossiblyMutableDictionary:(id)dictionary
   mutable:(BOOL)isMutable;

Instead of trying to test the dictionary object for mutability (which won't 
work), simply check isMutable.

--Andy

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSUndoManager retain/release of arguments - ad infinitum

2011-01-14 Thread Gary L. Wade
> I'm sure you'd agree that when we're learning a new environment, references 
> and documentation are only
> part of the process. If we can't figure out the docs, and lacking an expert 
> in the next cubicle to ask,
> then writing a test app will usually quickly answer our question. This is 
> where a legitimate need to
> verify and check object ownership comes from.

If you differentiate between these, check out the sample code Apple has made 
available as well as the old WWDC videos, which may provide you with a feel 
like "an expert in the next cubicle."

- Gary L. Wade (Sent from my iPhone)

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Maintaining NSCursor outside of app window

2011-01-14 Thread Corbin Dunn

On Jan 14, 2011, at 1:00 AM, Uli Kusterer wrote:

> On 14.01.2011, at 01:37, Corbin Dunn wrote:
>> - (void)draggedImage:(NSImage *)draggedImage movedTo:(NSPoint)screenPoint
>> 
>> Then do something like this (after converting the screen point to window 
>> coords):
>> 
>>   NSPoint windowPoint = [[view window] mouseLocationOutsideOfEventStream];
>>   NSPoint localPoint = [view convertPoint:windowPoint fromView:nil];
> 
> The OS will be very disappointed if it hands you a screenPoint and you just 
> completely ignore it and use mouseLocationOutsideOfEventStream instead.

Sorry; I had contrived the example from some bits of code I had around. It is 
probably better to use the screenPoint passed to you. There was a reason 
mouseLocationOutsideOfEventStream is used in the above code...but I forget what 
it is.

But, FWIW, the OS won't be disappointed if you do this. It is perfectly 
acceptable. Try dragging an item out of Finder's sidebar on 10.6. If you think 
performance is unacceptable, then please log a bug:

http://bugreporter.apple.com

--corbin


> Due to lag, CPU load etc. It sounds like a better idea to use the parameter.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Corbin Dunn

On Jan 14, 2011, at 4:44 AM, Tito Ciuro wrote:

> Hi Pablo,
> 
> On Jan 14, 2011, at 1:35 PM, Pablo Pons Bordes wrote:
> 
>> Hello,
>> 
>> To determine if a dictionary is mutable or Inmutable you just need to use 
>> the isKindOfClass method, instead of use respondsToSelector.
>> 
>> I did a test to reproduce your problem and couldn't reproduce your problem, 
>> so my conclusion is that actually you are receiving a mutable Dictionary 
>> when you think is unMutable 
> 
> Hm. No, I'm not getting a mutable dictionary because I'm seeing a log message 
> complaining that I'm trying to call setObject:forKey: on an immutable object.

I think you should work backwards on this one...break on NSLog and go from 
there

Something's mutating an dictionary that shouldn't be mutated.

corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSUndoManager retain/release of arguments - ad infinitum

2011-01-14 Thread Uli Kusterer
On Jan 11, 2011, at 7:35 AM, Jerry Krinock wrote:
> On 2011 Jan 10, at 21:39, Graham Cox wrote:
> 
>> As suggested, to undo a sort, pass the old descriptors to the undo manager 
>> and when undo is invoked, it restores the old descriptors and once again 
>> invalidates the cache.
> 
> But that assumes that the data was sorted with some old descriptors to begin 
> with.  It seems like this would not work if the objects had been manually 
> arranged into some arbitrary order by the user.

 Guys, why is sorting like this even an undo-able action in your apps ... ? 
That's pointless. Look at iTunes to see how you'd really do it: You'd have one 
column for the user-defined sort order (which conceptually contains an index by 
which you can sort that the user can change by dragging). So, to undo a sort, 
the user simply clicks another header.

 The way Jerry seems to have it right now, if I simply click a list header, my 
carefully hand-crafted item order is irrevocably destroyed. I can at best undo 
it. Sort order/list headers are a view-specific attribute. They shouldn't 
affect the model.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSSegmentedControl Label

2011-01-14 Thread koko
I would like to programmatically set the label for a section of an 
NSSegmentedControl which would contain text and a graphic.  Is there a 
recommended manner to accomplish this?

-koko
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


mouseDown in NSSegmentedControl

2011-01-14 Thread koko
I have sub-classed NSSegmentedControl and set this class to the 
NSSegmentedControl in IB.

I have implemented mouseDown in the sub-class thinking I would get these 
events.  I do not.

How does one get mouseDown in an NSSegmentedControl?

-koko


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread Matt Neuburg
On Fri, 14 Jan 2011 11:01:15 -0700, koko  said:
>I would like to programmatically set the label for a section of an 
>NSSegmentedControl which would contain text and a graphic.  Is there a 
>recommended manner to accomplish this?

The usual way to discover the recommended manner is to read the documentation:

http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/SegmentedControl/Articles/SegmentedControlCode.html

m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread koko
Thanks Matt but the documentation is no help whatsoever. I read it.

The question remains ... What is the recommended manner to put text and graphic 
in one segment of an NSSegmentedControl.


-koko




On Jan 14, 2011, at 1:09 PM, Matt Neuburg wrote:

> On Fri, 14 Jan 2011 11:01:15 -0700, koko  said:
>> I would like to programmatically set the label for a section of an 
>> NSSegmentedControl which would contain text and a graphic.  Is there a 
>> recommended manner to accomplish this?
> 
> The usual way to discover the recommended manner is to read the documentation:
> 
> http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/SegmentedControl/Articles/SegmentedControlCode.html
> 
> m.
> 
> --
> matt neuburg, phd = m...@tidbits.com, 
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.apeth.net/matt/default.html#applescriptthings___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net
> 
> This email sent to k...@highrolls.net
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 1/14/11 12:28 PM, koko wrote:
> Thanks Matt but the documentation is no help whatsoever. I read it.
> 
> The question remains ... What is the recommended manner to put text
> and graphic in one segment of an NSSegmentedControl.

It's not recommended.

- From the linked documentation:

"A segment should have either an icon or a text label, but not both. See
Controls in Apple Human Interface Guidelines."



- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFNMLMIaOlrz5+0JdURAu2yAJ98s5tR4MLmSOuBkzLQVsi1wWh49QCdE6rk
679r5T9VAx21tOr1DXv9La8=
=DY6V
-END PGP SIGNATURE-
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread jonat...@mugginsoft.com

On 14 Jan 2011, at 20:28, koko wrote:

> Thanks Matt but the documentation is no help whatsoever. I read it.
> 
> The question remains ... What is the recommended manner to put text and 
> graphic in one segment of an NSSegmentedControl.
> 
> 
> 

Try the docs for NSSegmentedCell.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread koko
It may not be recommended but I want to do it.  Should I get permission from 
from steven p jobs first?

Apple HIG is not the be-all, end-all of UI design.

-koko

On Jan 14, 2011, at 1:33 PM, Conrad Shultz wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 1/14/11 12:28 PM, koko wrote:
>> Thanks Matt but the documentation is no help whatsoever. I read it.
>> 
>> The question remains ... What is the recommended manner to put text
>> and graphic in one segment of an NSSegmentedControl.
> 
> It's not recommended.
> 
> - From the linked documentation:
> 
> "A segment should have either an icon or a text label, but not both. See
> Controls in Apple Human Interface Guidelines."
> 
> 
> 
> - -- 
> Conrad Shultz
> 
> Synthetiq Solutions
> www.synthetiqsolutions.com
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iD8DBQFNMLMIaOlrz5+0JdURAu2yAJ98s5tR4MLmSOuBkzLQVsi1wWh49QCdE6rk
> 679r5T9VAx21tOr1DXv9La8=
> =DY6V
> -END PGP SIGNATURE-
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread Kyle Sluder
On Fri, Jan 14, 2011 at 12:38 PM, koko  wrote:
> It may not be recommended but I want to do it.  Should I get permission from 
> from steven p jobs first?
>
> Apple HIG is not the be-all, end-all of UI design.

No, but it is the design document by which the AppKit implementors
write their code.

If it doesn't support it, you can't do it.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


RE: NSSegmentedControl Label

2011-01-14 Thread Shawn Bakhtiar

Don't listen to the naysayers... You can do whatever you want. 

NSSegmentedCell is a good start, as it was recommended. More generically you 
can implement your own NSCell to really get deep; in either case simply 
override the draw method, and make sure you are checking the state, and drawing 
accordingly (so your draw function draws the correct highlights, ie if it is 
pressed). In fact NSButton is nothing more than a wrapper function for 
NSButtonCell (derive classes from it with drawInRect overrides all the time).

Conceptually an NCCell (which includes all the different Cell types) is no 
different than an NSView, simply less resource intensive (using the same 
context as its super view, etc...) to draw, instead of created a new drawing 
context. 

So just like you can draw to a view you can draw to a cell, the frame and 
bounds are simply given as the area of the cell instead of the area of the view 
(which can have many cells in it). 


Following Apples recommendation is just that, recommendation. You don't have to 
DO or DON'T anything, however, if your 
intention is to provide a good interface to your users, following their 
recommendation is not a bad idea. Cluttering such a small area with an icon
 and text may take away from the user experience instead of enhancing it. but 
as far as it does not support it, no such thing. Nothing could be father from 
the truth, you can always added any missing functionality, or override any ones 
you don't like.

IMHO


 

> Date: Fri, 14 Jan 2011 12:44:19 -0800
> From: kyle.slu...@gmail.com
> To: k...@highrolls.net
> CC: cocoa-dev@lists.apple.com
> Subject: Re: NSSegmentedControl Label
> 
> On Fri, Jan 14, 2011 at 12:38 PM, koko  wrote:
> > It may not be recommended but I want to do it.  Should I get permission 
> > from from steven p jobs first?
> >
> > Apple HIG is not the be-all, end-all of UI design.
> 
> No, but it is the design document by which the AppKit implementors
> write their code.
> 
> If it doesn't support it, you can't do it.
> 
> --Kyle Sluder
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/shashaness%40hotmail.com
> 
> This email sent to shashan...@hotmail.com
  
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIDatePicker displays incorrect day in UIDatePickerDateAndTime mode for zones 12+ hours ahead of defaultZone

2011-01-14 Thread Deborah Goldsmith
Did you write a bug for this? What is the bug number?

Thanks,
Deborah Goldsmith
Apple Inc.

On Jan 10, 2011, at 10:12 AM, Steve Mykytyn wrote:

> UIDatePicker (4.2.1) shows differing dates for the modes 
> 
>  UIDatePickerDate (correct),  and
> 
>  UIDatePickerDateAndTime (incorrect) 
> 
> when the timezone you assign to the UIDatePicker is 
> 
>  - more than 12 hours ahead (east) of the systemTimeZone of the iPhone.
> 
> For example, 
> 
>  device system time zone = America/Los Angeles = GMT - 8
> 
>  Honolulu date: Dec 7, 1941 7:48am
> 
>  Tokyo date: Dec 8, 1941 3:18am
> 
> UIDatePicker will show the Tokyo date for mode
> 
>  UIDatePickerDate (correct): Dec 8, 1941
> 
>  UIDatePickerDateAndTime: Dec 7, 1941
> 
> In fact, UIDatePicker will show incorrect dates in this case for any time 
> zone east of GMT + 4 (always one day before correct day)
> 
> 
> A work-around in viewDidLoad is:
> 
>   self.datePicker.datePickerMode = UIDatePickerModeDateAndTime;   
>   
>   self.datePicker.minuteInterval = 1;
> 
>   self.datePicker.timeZone = timeZone;
>   
>   [NSTimeZone setDefaultTimeZone:timeZone];  //  *** add this line to 
> force date picker to show correct date in all modes
>   
>   [self.datePicker setDate:tzDate animated:YES];  
> 
> and in viewWillDisappear add:
> 
>   [NSTimeZone resetSystemTimeZone];
> 
>   [NSTimeZone setDefaultTimeZone:[NSTimeZone systemTimeZone]];
> 
> Not super happy about the work-around, but it should be fairly robust even if 
> this bug is fixed in future.
> 
> If anyone can shed some light on this behavior, please advise.  No amount of 
> fooling around with calendars, locales, etc. fixed this until i reset the 
> default zone.
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/goldsmit%40apple.com
> 
> This email sent to golds...@apple.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: mouseDown in NSSegmentedControl

2011-01-14 Thread aglee

Did you override mouseDown or mouseDown:?

--Andy

On Jan 14, 2011, at 03:08 PM, koko  wrote:

I have sub-classed NSSegmentedControl and set this class to the 
NSSegmentedControl in IB.

I have implemented mouseDown in the sub-class thinking I would get these 
events. I do not.

How does one get mouseDown in an NSSegmentedControl?

-koko
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIDatePicker displays incorrect day in UIDatePickerDateAndTime mode for zones 12+ hours ahead of defaultZone

2011-01-14 Thread davelist

I'm not the original author of this thread, but I submitted a bug back in 
August 2010 about these issues. It was marked as a duplicate and I've never 
heard anything more. Perhaps I don't know how to properly follow duplicates. My 
bug # is 8320528.

Dave


On Jan 14, 2011, at 4:34 PM, Deborah Goldsmith wrote:

> Did you write a bug for this? What is the bug number?
> 
> Thanks,
> Deborah Goldsmith
> Apple Inc.
> 
> On Jan 10, 2011, at 10:12 AM, Steve Mykytyn wrote:
> 
>> UIDatePicker (4.2.1) shows differing dates for the modes 
>> 
>> UIDatePickerDate (correct),  and
>> 
>> UIDatePickerDateAndTime (incorrect) 
>> 
>> when the timezone you assign to the UIDatePicker is 
>> 
>> - more than 12 hours ahead (east) of the systemTimeZone of the iPhone.
>> 
>> For example, 
>> 
>> device system time zone = America/Los Angeles = GMT - 8
>> 
>> Honolulu date: Dec 7, 1941 7:48am
>> 
>> Tokyo date: Dec 8, 1941 3:18am
>> 
>> UIDatePicker will show the Tokyo date for mode
>> 
>> UIDatePickerDate (correct): Dec 8, 1941
>> 
>> UIDatePickerDateAndTime: Dec 7, 1941
>> 
>> In fact, UIDatePicker will show incorrect dates in this case for any time 
>> zone east of GMT + 4 (always one day before correct day)
>> 
>> 
>> A work-around in viewDidLoad is:
>> 
>>  self.datePicker.datePickerMode = UIDatePickerModeDateAndTime;   
>>  
>>  self.datePicker.minuteInterval = 1;
>> 
>>  self.datePicker.timeZone = timeZone;
>>  
>>  [NSTimeZone setDefaultTimeZone:timeZone];  //  *** add this line to 
>> force date picker to show correct date in all modes
>>  
>>  [self.datePicker setDate:tzDate animated:YES];  
>> 
>> and in viewWillDisappear add:
>> 
>>  [NSTimeZone resetSystemTimeZone];
>> 
>>  [NSTimeZone setDefaultTimeZone:[NSTimeZone systemTimeZone]];
>> 
>> Not super happy about the work-around, but it should be fairly robust even 
>> if this bug is fixed in future.
>> 
>> If anyone can shed some light on this behavior, please advise.  No amount of 
>> fooling around with calendars, locales, etc. fixed this until i reset the 
>> default zone.
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/goldsmit%40apple.com
>> 
>> This email sent to golds...@apple.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/davelist%40mac.com
> 
> This email sent to davel...@mac.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Converting NSImage to cmtk yeilds green images

2011-01-14 Thread Ken Tozier
Hi

I'm trying to write an NSImage category that converts an image to cmyk . It 
sort of works, in that it does produce a new image, but all images have a dark 
green cast to them and look sort of solarized or like negatives. Anyone point 
out what I'm doing wrong?

Thanks for any help

- (NSImage *) cmykImage
{
NSImage *result = [[NSImage alloc] 
initWithSize: [self size]];

NSBitmapImageRep*rep= [[NSBitmapImageRep 
alloc] 

initWithBitmapDataPlanes: NULL

pixelsWide: [self size].width

pixelsHigh: [self size].height

bitsPerSample: 8

samplesPerPixel: 4

hasAlpha: NO

isPlanar: NO

colorSpaceName: NSDeviceCMYKColorSpace

bytesPerRow: 0

bitsPerPixel: 0];


NSGraphicsContext   *context= [NSGraphicsContext 
graphicsContextWithBitmapImageRep: rep];

[NSGraphicsContext setCurrentContext: context];

[context setImageInterpolation: NSImageInterpolationHigh];

[self compositeToPoint: NSZeroPoint operation: NSCompositeSourceOver];

[result addRepresentation: rep];

return result;
}___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSUndoManager retain/release of arguments - ad infinitum

2011-01-14 Thread Graham Cox

On 15/01/2011, at 4:50 AM, Uli Kusterer wrote:

> Guys, why is sorting like this even an undo-able action in your apps ... ? 
> That's pointless.


Not always pointless. Probably mostly. Depends on the app.

Personally I have never bothered to make sorting undoable - I was thinking 
hypothetically. However I have implemented the caching of sorting in the manner 
described (though more as a controller-level implementation than a model one) 
because I've found that sorting thousands of items when supplying them to e.g. 
a table view or icon view to be a major performance drag.

--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIDatePicker displays incorrect day in UIDatePickerDateAndTime mode for zones 12+ hours ahead of defaultZone

2011-01-14 Thread Laurent Daudelin
From what I was told by Apple developer support, you're supposed to add a 
comment to your duplicate requesting an update for the original ticket.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.com

On Jan 14, 2011, at 13:57, davel...@mac.com wrote:

> 
> I'm not the original author of this thread, but I submitted a bug back in 
> August 2010 about these issues. It was marked as a duplicate and I've never 
> heard anything more. Perhaps I don't know how to properly follow duplicates. 
> My bug # is 8320528.
> 
> Dave
> 
> 
> On Jan 14, 2011, at 4:34 PM, Deborah Goldsmith wrote:
> 
>> Did you write a bug for this? What is the bug number?
>> 
>> Thanks,
>> Deborah Goldsmith
>> Apple Inc.
>> 
>> On Jan 10, 2011, at 10:12 AM, Steve Mykytyn wrote:
>> 
>>> UIDatePicker (4.2.1) shows differing dates for the modes 
>>> 
>>> UIDatePickerDate (correct),  and
>>> 
>>> UIDatePickerDateAndTime (incorrect) 
>>> 
>>> when the timezone you assign to the UIDatePicker is 
>>> 
>>> - more than 12 hours ahead (east) of the systemTimeZone of the iPhone.
>>> 
>>> For example, 
>>> 
>>> device system time zone = America/Los Angeles = GMT - 8
>>> 
>>> Honolulu date: Dec 7, 1941 7:48am
>>> 
>>> Tokyo date: Dec 8, 1941 3:18am
>>> 
>>> UIDatePicker will show the Tokyo date for mode
>>> 
>>> UIDatePickerDate (correct): Dec 8, 1941
>>> 
>>> UIDatePickerDateAndTime: Dec 7, 1941
>>> 
>>> In fact, UIDatePicker will show incorrect dates in this case for any time 
>>> zone east of GMT + 4 (always one day before correct day)
>>> 
>>> 
>>> A work-around in viewDidLoad is:
>>> 
>>> self.datePicker.datePickerMode = UIDatePickerModeDateAndTime;   
>>> 
>>> self.datePicker.minuteInterval = 1;
>>> 
>>> self.datePicker.timeZone = timeZone;
>>> 
>>> [NSTimeZone setDefaultTimeZone:timeZone];  //  *** add this line to 
>>> force date picker to show correct date in all modes
>>> 
>>> [self.datePicker setDate:tzDate animated:YES];  
>>> 
>>> and in viewWillDisappear add:
>>> 
>>> [NSTimeZone resetSystemTimeZone];
>>> 
>>> [NSTimeZone setDefaultTimeZone:[NSTimeZone systemTimeZone]];
>>> 
>>> Not super happy about the work-around, but it should be fairly robust even 
>>> if this bug is fixed in future.
>>> 
>>> If anyone can shed some light on this behavior, please advise.  No amount 
>>> of fooling around with calendars, locales, etc. fixed this until i reset 
>>> the default zone.
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> 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:
>>> http://lists.apple.com/mailman/options/cocoa-dev/goldsmit%40apple.com
>>> 
>>> This email sent to golds...@apple.com
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/davelist%40mac.com
>> 
>> This email sent to davel...@mac.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/laurent%40nemesys-soft.com
> 
> This email sent to laur...@nemesys-soft.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIDatePicker displays incorrect day in UIDatePickerDateAndTime mode for zones 12+ hours ahead of defaultZone

2011-01-14 Thread David Reed

Thanks. I should have indicated I did add an additional comment to my bug a 
month or two later when it wasn't fixed. The only response from Apple in my bug 
report is the original duplication comment.

Dave

On Jan 14, 2011, at 5:13 PM, Laurent Daudelin wrote:

> From what I was told by Apple developer support, you're supposed to add a 
> comment to your duplicate requesting an update for the original ticket.
> 
> -Laurent.
> -- 
> Laurent Daudelin
> AIM/iChat/Skype:LaurentDaudelin   
> http://www.nemesys-soft.com/
> Logiciels Nemesys Software
> laur...@nemesys-soft.com
> 
> On Jan 14, 2011, at 13:57, davel...@mac.com wrote:
> 
>> 
>> I'm not the original author of this thread, but I submitted a bug back in 
>> August 2010 about these issues. It was marked as a duplicate and I've never 
>> heard anything more. Perhaps I don't know how to properly follow duplicates. 
>> My bug # is 8320528.
>> 
>> Dave
>> 
>> 
>> On Jan 14, 2011, at 4:34 PM, Deborah Goldsmith wrote:
>> 
>>> Did you write a bug for this? What is the bug number?
>>> 
>>> Thanks,
>>> Deborah Goldsmith
>>> Apple Inc.
>>> 
>>> On Jan 10, 2011, at 10:12 AM, Steve Mykytyn wrote:
>>> 
 UIDatePicker (4.2.1) shows differing dates for the modes 
 
 UIDatePickerDate (correct),  and
 
 UIDatePickerDateAndTime (incorrect) 
 
 when the timezone you assign to the UIDatePicker is 
 
 - more than 12 hours ahead (east) of the systemTimeZone of the iPhone.
 
 For example, 
 
 device system time zone = America/Los Angeles = GMT - 8
 
 Honolulu date: Dec 7, 1941 7:48am
 
 Tokyo date: Dec 8, 1941 3:18am
 
 UIDatePicker will show the Tokyo date for mode
 
 UIDatePickerDate (correct): Dec 8, 1941
 
 UIDatePickerDateAndTime: Dec 7, 1941
 
 In fact, UIDatePicker will show incorrect dates in this case for any time 
 zone east of GMT + 4 (always one day before correct day)
 
 
 A work-around in viewDidLoad is:
 
self.datePicker.datePickerMode = UIDatePickerModeDateAndTime;   

self.datePicker.minuteInterval = 1;
 
self.datePicker.timeZone = timeZone;

[NSTimeZone setDefaultTimeZone:timeZone];  //  *** add this line to 
 force date picker to show correct date in all modes

[self.datePicker setDate:tzDate animated:YES];  
 
 and in viewWillDisappear add:
 
[NSTimeZone resetSystemTimeZone];
 
[NSTimeZone setDefaultTimeZone:[NSTimeZone systemTimeZone]];
 
 Not super happy about the work-around, but it should be fairly robust even 
 if this bug is fixed in future.
 
 If anyone can shed some light on this behavior, please advise.  No amount 
 of fooling around with calendars, locales, etc. fixed this until i reset 
 the default zone.
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/goldsmit%40apple.com
 
 This email sent to golds...@apple.com
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> 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:
>>> http://lists.apple.com/mailman/options/cocoa-dev/davelist%40mac.com
>>> 
>>> This email sent to davel...@mac.com
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/laurent%40nemesys-soft.com
>> 
>> This email sent to laur...@nemesys-soft.com
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Tito Ciuro
Thanks a lot everyone for the great feedback. I really appreciate it! :-)

Cheers,

-- Tito

On Jan 14, 2011, at 6:39 PM, Corbin Dunn wrote:

> 
> On Jan 14, 2011, at 4:44 AM, Tito Ciuro wrote:
> 
>> Hi Pablo,
>> 
>> On Jan 14, 2011, at 1:35 PM, Pablo Pons Bordes wrote:
>> 
>>> Hello,
>>> 
>>> To determine if a dictionary is mutable or Inmutable you just need to use 
>>> the isKindOfClass method, instead of use respondsToSelector.
>>> 
>>> I did a test to reproduce your problem and couldn't reproduce your problem, 
>>> so my conclusion is that actually you are receiving a mutable Dictionary 
>>> when you think is unMutable 
>> 
>> Hm. No, I'm not getting a mutable dictionary because I'm seeing a log 
>> message complaining that I'm trying to call setObject:forKey: on an 
>> immutable object.
> 
> I think you should work backwards on this one...break on NSLog and go from 
> there
> 
> Something's mutating an dictionary that shouldn't be mutated.
> 
> corbin
> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread koko
IMHO I like your answer ... thanks!

-koko


On Jan 14, 2011, at 2:17 PM, Shawn Bakhtiar wrote:

> Don't listen to the naysayers... You can do whatever you want. 
> 
> NSSegmentedCell is a good start, as it was recommended. More generically you 
> can implement your own NSCell to really get deep; in either case simply 
> override the draw method, and make sure you are checking the state, and 
> drawing accordingly (so your draw function draws the correct highlights, ie 
> if it is pressed). In fact NSButton is nothing more than a wrapper function 
> for NSButtonCell (derive classes from it with drawInRect overrides all the 
> time).
> 
> Conceptually an NCCell (which includes all the different Cell types) is no 
> different than an NSView, simply less resource intensive (using the same 
> context as its super view, etc...) to draw, instead of created a new drawing 
> context. 
> 
> So just like you can draw to a view you can draw to a cell, the frame and 
> bounds are simply given as the area of the cell instead of the area of the 
> view (which can have many cells in it). 
> 
> Following Apples recommendation is just that, recommendation. You don't have 
> to DO or DON'T anything, however, if your intention is to provide a good 
> interface to your users, following their recommendation is not a bad idea. 
> Cluttering such a small area with an icon and text may take away from the 
> user experience instead of enhancing it. but as far as it does not support 
> it, no such thing. Nothing could be father from the truth, you can always 
> added any missing functionality, or override any ones you don't like.
> 
> IMHO
> 
>  
> 
> > Date: Fri, 14 Jan 2011 12:44:19 -0800
> > From: kyle.slu...@gmail.com
> > To: k...@highrolls.net
> > CC: cocoa-dev@lists.apple.com
> > Subject: Re: NSSegmentedControl Label
> > 
> > On Fri, Jan 14, 2011 at 12:38 PM, koko  wrote:
> > > It may not be recommended but I want to do it.  Should I get permission 
> > > from from steven p jobs first?
> > >
> > > Apple HIG is not the be-all, end-all of UI design.
> > 
> > No, but it is the design document by which the AppKit implementors
> > write their code.
> > 
> > If it doesn't support it, you can't do it.
> > 
> > --Kyle Sluder
> > ___
> > 
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> > 
> > 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:
> > http://lists.apple.com/mailman/options/cocoa-dev/shashaness%40hotmail.com
> > 
> > This email sent to shashan...@hotmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread Laurent Daudelin
Please, read this to see where no or little respect to the HIG could take us: 
http://readthefuckinghig.tumblr.com/

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.com

On Jan 14, 2011, at 15:20, koko wrote:

> IMHO I like your answer ... thanks!
> 
> -koko
> 
> 
> On Jan 14, 2011, at 2:17 PM, Shawn Bakhtiar wrote:
> 
>> Don't listen to the naysayers... You can do whatever you want. 
>> 
>> NSSegmentedCell is a good start, as it was recommended. More generically you 
>> can implement your own NSCell to really get deep; in either case simply 
>> override the draw method, and make sure you are checking the state, and 
>> drawing accordingly (so your draw function draws the correct highlights, ie 
>> if it is pressed). In fact NSButton is nothing more than a wrapper function 
>> for NSButtonCell (derive classes from it with drawInRect overrides all the 
>> time).
>> 
>> Conceptually an NCCell (which includes all the different Cell types) is no 
>> different than an NSView, simply less resource intensive (using the same 
>> context as its super view, etc...) to draw, instead of created a new drawing 
>> context. 
>> 
>> So just like you can draw to a view you can draw to a cell, the frame and 
>> bounds are simply given as the area of the cell instead of the area of the 
>> view (which can have many cells in it). 
>> 
>> Following Apples recommendation is just that, recommendation. You don't have 
>> to DO or DON'T anything, however, if your intention is to provide a good 
>> interface to your users, following their recommendation is not a bad idea. 
>> Cluttering such a small area with an icon and text may take away from the 
>> user experience instead of enhancing it. but as far as it does not support 
>> it, no such thing. Nothing could be father from the truth, you can always 
>> added any missing functionality, or override any ones you don't like.
>> 
>> IMHO
>> 
>> 
>> 
>>> Date: Fri, 14 Jan 2011 12:44:19 -0800
>>> From: kyle.slu...@gmail.com
>>> To: k...@highrolls.net
>>> CC: cocoa-dev@lists.apple.com
>>> Subject: Re: NSSegmentedControl Label
>>> 
>>> On Fri, Jan 14, 2011 at 12:38 PM, koko  wrote:
 It may not be recommended but I want to do it.  Should I get permission 
 from from steven p jobs first?
 
 Apple HIG is not the be-all, end-all of UI design.
>>> 
>>> No, but it is the design document by which the AppKit implementors
>>> write their code.
>>> 
>>> If it doesn't support it, you can't do it.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread Kyle Sluder
On Fri, Jan 14, 2011 at 1:17 PM, Shawn Bakhtiar  wrote:
> Don't listen to the naysayers... You can do whatever you want.

Sure, but koko asked how he could tell an NSSegmentedCell to draw its
image and its text. It's apparent that the authors of NSSegmentedCell
did not implement this, because why implement something that the HIG
authors are going to discourage people from using anyway?

Images-and-text on segmented cells can look atrocious. It can look
like Windows. It can look like someone feels like disrespecting
platform conventions. But sometimes violating the HIG is precisely the
right thing to do. That's why they're called guidelines.

Taking offense at the HIG and equating it to "asking Steve Jobs for
permission" exposes a lack of appreciation for what convention brings
to the table.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread Sherm Pendley
On Fri, Jan 14, 2011 at 6:35 PM, Kyle Sluder  wrote:
>
> Images-and-text on segmented cells can look atrocious. It can look
> like Windows. It can look like someone feels like disrespecting
> platform conventions. But sometimes violating the HIG is precisely the
> right thing to do. That's why they're called guidelines.

Sometimes, certainly - but not without a *very* good reason. "Because
the Windows version looks like that" isn't a good reason. Newcomers to
the platform should google "Word 6 fiasco" (including the quotes), and
learn from Microsoft's mistakes. Basically, they tried to make Word 6
look and feel as close as possible to the Windows version, and the
result was a disaster.

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.net
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread Conrad Shultz
As others (notably Kyle) have pointed out, there is no need to act so 
defensively. 

You specifically asked what the "recommended" way to do this is, and I simply 
pointed out that the approach is NOT recommended.

--
Conrad Shultz
www.sythetiqsolutions.com

On Jan 14, 2011, at 12:38, koko  wrote:

> It may not be recommended but I want to do it.  Should I get permission from 
> from steven p jobs first?
> 
> Apple HIG is not the be-all, end-all of UI design.
> 
> -koko
> 
> On Jan 14, 2011, at 1:33 PM, Conrad Shultz wrote:
> 
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>> 
>> On 1/14/11 12:28 PM, koko wrote:
>>> Thanks Matt but the documentation is no help whatsoever. I read it.
>>> 
>>> The question remains ... What is the recommended manner to put text
>>> and graphic in one segment of an NSSegmentedControl.
>> 
>> It's not recommended.
>> 
>> - From the linked documentation:
>> 
>> "A segment should have either an icon or a text label, but not both. See
>> Controls in Apple Human Interface Guidelines."
>> 
>> 
>> 
>> - -- 
>> Conrad Shultz
>> 
>> Synthetiq Solutions
>> www.synthetiqsolutions.com
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1.4.7 (Darwin)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>> 
>> iD8DBQFNMLMIaOlrz5+0JdURAu2yAJ98s5tR4MLmSOuBkzLQVsi1wWh49QCdE6rk
>> 679r5T9VAx21tOr1DXv9La8=
>> =DY6V
>> -END PGP SIGNATURE-
>> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSSegmentedControl Label

2011-01-14 Thread koko
Ouch!

Some of us need to lighten up ... it is software engineering not rocket science 
... I am not going to make anything ugly ... I want  my app to be visually 
appealing and "intuitive".  The intuitive part is what I am trying to get to; 
it is something pointed out by a number of users.

By the way, we released the program as public beta the week before Christmas 
and released it on 12.24, we are doing an average of $400 per day in sales.  So 
I would say we do have something our market wants and we do not make "ugly" UI. 

-koko


On Jan 14, 2011, at 5:34 PM, Conrad Shultz wrote:

> As others (notably Kyle) have pointed out, there is no need to act so 
> defensively. 
> 
> You specifically asked what the "recommended" way to do this is, and I simply 
> pointed out that the approach is NOT recommended.
> 
> --
> Conrad Shultz
> www.sythetiqsolutions.com
> 
> On Jan 14, 2011, at 12:38, koko  wrote:
> 
>> It may not be recommended but I want to do it.  Should I get permission from 
>> from steven p jobs first?
>> 
>> Apple HIG is not the be-all, end-all of UI design.
>> 
>> -koko
>> 
>> On Jan 14, 2011, at 1:33 PM, Conrad Shultz wrote:
>> 
>>> -BEGIN PGP SIGNED MESSAGE-
>>> Hash: SHA1
>>> 
>>> On 1/14/11 12:28 PM, koko wrote:
 Thanks Matt but the documentation is no help whatsoever. I read it.
 
 The question remains ... What is the recommended manner to put text
 and graphic in one segment of an NSSegmentedControl.
>>> 
>>> It's not recommended.
>>> 
>>> - From the linked documentation:
>>> 
>>> "A segment should have either an icon or a text label, but not both. See
>>> Controls in Apple Human Interface Guidelines."
>>> 
>>> 
>>> 
>>> - -- 
>>> Conrad Shultz
>>> 
>>> Synthetiq Solutions
>>> www.synthetiqsolutions.com
>>> -BEGIN PGP SIGNATURE-
>>> Version: GnuPG v1.4.7 (Darwin)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>> 
>>> iD8DBQFNMLMIaOlrz5+0JdURAu2yAJ98s5tR4MLmSOuBkzLQVsi1wWh49QCdE6rk
>>> 679r5T9VAx21tOr1DXv9La8=
>>> =DY6V
>>> -END PGP SIGNATURE-
>>> 
>> 
> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Overriding target and action of backBarButtonItem

2011-01-14 Thread charisse napeÿfffff1as
Hello Matt,

Yeah. that's what I also thought. I just needed somebody who knows more to 
actually confirm it.

Anyway, So how can I customize what happens when the user presses the back 
button? 



THanks,
Charisse



From: Matt Neuburg 
To: charisse nape?f1as 
Cc: cocoa-dev@lists.apple.com
Sent: Friday, January 14, 2011 23:47:12
Subject: Re: Overriding target and action of backBarButtonItem

On Fri, 14 Jan 2011 01:17:58 -0800 (PST), charisse nape?f1as 
 said:
>Hello Guys,
>
>I have trouble setting the action for my backbarbutton item. No matter how I 
>set 
>
>it, my selector does not get called.
>Here is my code below:
>
>
>UIBarButtonItem *backB = [[UIBarButtonItem alloc] init];
>backB.title = @"Back";
>backB.action = @selector(disconnect:);
>self.navigationItem.backBarButtonItem = backB;
>[backB release];
>
>Assume I created a disconnect() function already.
>
>But if I use leftBarButtonItem my function gets called. Is this because the 
>backBarButton item already has its function to dismiss the view? Can't I 
>override it somehow?

No, you really can't. A backBarButton item should have a nil select and target, 
allowing it to perform its standard function, namely to go back. However, you 
can perform other trickery that allows you to customize what happens at that 
moment. You can change beforehand what the user will go back *to*, and you can 
hear through a notification when the user does go back. Any further advice 
would 
depend upon your explaining what you are really trying to accomplish. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Determining whether a dictionary is mutable or not

2011-01-14 Thread Ken Ferry
I'm not sure this has been made clear:  It is intentional that it is
difficult to determine whether a dictionary is mutable.

That's because you shouldn't do it.  Whether a dictionary is mutable
_to_you_ is a matter of what's in the header for the method you obtained it
from.

Suppose that some object keeps a mutable array as its internal state.  It
also has an accessor that lets you look at the array as an immutable array.
 If you introspect it and realize its mutable, is it safe to mutate?  No!
 It's part of the object's internal state, you cannot just mess with it.

It is unsafe in general to introspect mutability.

-Ken
Cocoa Frameworks

On Fri, Jan 14, 2011 at 3:01 PM, Tito Ciuro  wrote:

> Thanks a lot everyone for the great feedback. I really appreciate it! :-)
>
> Cheers,
>
> -- Tito
>
> On Jan 14, 2011, at 6:39 PM, Corbin Dunn wrote:
>
> >
> > On Jan 14, 2011, at 4:44 AM, Tito Ciuro wrote:
> >
> >> Hi Pablo,
> >>
> >> On Jan 14, 2011, at 1:35 PM, Pablo Pons Bordes wrote:
> >>
> >>> Hello,
> >>>
> >>> To determine if a dictionary is mutable or Inmutable you just need to
> use the isKindOfClass method, instead of use respondsToSelector.
> >>>
> >>> I did a test to reproduce your problem and couldn't reproduce your
> problem, so my conclusion is that actually you are receiving a mutable
> Dictionary when you think is unMutable
> >>
> >> Hm. No, I'm not getting a mutable dictionary because I'm seeing a log
> message complaining that I'm trying to call setObject:forKey: on an
> immutable object.
> >
> > I think you should work backwards on this one...break on NSLog and go
> from there
> >
> > Something's mutating an dictionary that shouldn't be mutated.
> >
> > corbin
> >
> >
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com