Re: Embedding a system preference pane
Re: Embedding a system preference pane
- Subject: Re: Embedding a system preference pane
- From: Knut Lorenzen <email@hidden>
- Date: Fri, 20 Aug 2010 21:19:38 +0200
Am 20.08.2010 um 10:44 schrieb Jon Guy:
> I'm trying to embed a couple of the system pref panes into an app by following the Apple documented method, here's basically whats going on:
<...>
I've slightly modified your code (mainWindow is the apps main window) to look like this:
NSBundle *prefBundle = [NSBundle bundleWithPath: @"/System/Library/PreferencePanes/SharingPref.prefPane"];
Class prefPaneClass = [prefBundle principalClass];
NSPreferencePane *prefPaneObject = [[prefPaneClass alloc] initWithBundle: prefBundle];
[prefPaneObject loadMainView];
[prefPaneObject willSelect];
[[mainWindow contentView] addSubview: [prefPaneObject mainView]];
[mainWindow makeKeyAndOrderFront: self];
[prefPaneObject didSelect];
Everything works fine for me (10.6.4, Xcode 3.2.3) - though there are several messages in the debugger console, saying:
service: This command still works, but it is deprecated. Please use launchctl(8) instead.
Tested with DateAndTime.prefPane, too (like mentioned in the documentation) and that works fine as well.
Cheers,
Knut
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden