Re: Embedding a system preference pane
Re: Embedding a system preference pane
- Subject: Re: Embedding a system preference pane
- From: Bill Bumgarner <email@hidden>
- Date: Fri, 20 Aug 2010 12:55:05 -0500
On Aug 20, 2010, at 3:44 AM, Jon Guy wrote:
> Hi
> 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:
>
> NSBundle *bundle = [NSBundle bundleWithPath:@"/System/Library/PreferencePanes/SharingPref.prefPane"];
> Class principalClass = [bundle principalClass];
> prefPane = [[principalClass alloc] initWithBundle:bundle];
> [prefPane loadMainView];
> [prefPane willSelect];
> prefView = [prefPane mainView];
> [[[self window] contentView] addSubview:prefView];
> [[self window] makeKeyAndOrderFront:self];
> [prefPane didSelect];
>
> This works fine for one of the other panes. I then tried it for the Sharing pref pane but it only seems to be half working. The Pane appears and I can see the computer name and the table with the list of services but only the DVD Sharing service is working (somewhat). None of the other services are reflecting the state of that service and they are always greyed out. Also when you select a service it's corresponding settings view does not appear on the right side of the table (I hope this is making sense). This is not something hacky, it is documented by Apple and is supposed to work but it's clearly not or I'm doing something wrong. Any help would be appreciated.
Preference panes are not designed to be embedded into applications other than the System Preferences application. Even if you were to make it work (which would require duplicating all of the internal functionality of the System Preferences application), you are setting yourself up for a maintenance and testing nightmare in that System Preferences' internal implementation details may change with any version of the OS, including the one-off interim versions that sometimes ship with new hardware.
I.e. don't do that.
b.bum
_______________________________________________
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