> On Apr 3, 2021, at 8:59 AM, Gabriel Zachmann <z...@cs.uni-bremen.de> wrote:
> 
> Thanks a lot for your response!
> 
>> How about something like this?
>> 
>>    NSUserDefaults *monitor1 = [[NSUserDefaults alloc] init];
>>    [monitor1 setBool:YES forKey:@"MyKey”];
>> 
>>    BOOL value = [monitor1 boolForKey:@"MyKey"];
> 
> So, where is the kind of monitor encoded?
> I mean, how does the code distinguish between the preferences of monitor1 and 
> monitor2?
> 
> Can you explain to me, what is the difference between 
>   [[NSUserDefaults alloc] init]
> and
>   [NSUserDefaults standardDefaults]
> ?
> I didn't get that from Apple's docs.
> 


From the docs - init returns an initialized NSUserDefaults object whose 
argument and registration domains are already set up. This method does not put 
anything in the search list. Invoke it only if you’ve allocated your own 
NSUserDefaults instance instead of using the shared one.

So it appears that using alloc int does not return the shared instance.

It would be up to you to determine the monitors attached to the computer using 
NSScreen and or CGDirectDisplay routines.

--Richard Charles

_______________________________________________

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

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

Reply via email to