Re: Positioning Controls
Re: Positioning Controls
- Subject: Re: Positioning Controls
- From: Scott Ribe <email@hidden>
- Date: Thu, 18 Apr 2013 10:27:52 -0600
On Apr 18, 2013, at 9:39 AM, Harmony Neil wrote:
> It would make things a whole lot easier if you could just do stuff by nice old writing the code, but alas no ...
You can actually do this. Although the whole paradigm that Apple's dev tools support promote doing it the visual way, in your case it might well make sense to create the control, place and position it in its superview, connect it to the controller's outlet, and set its action & target in code.
I've never needed to do this, so I can't give you complete step-by-step instructions, but I can give you a (possibly incomplete) guide to the methods you need:
--------------------------------------------------------------
myButton = [[[NSButton alloc] initWithFrame: ...] autorelease]
configure it, see the "Configuring Buttons" section of the NSButton Class Reference
[myButton setTarget: myController]
[myButton setAction: @selector(myActionMethod:)]
[[[myController window] contentView] addSubview: myButton]
myController->myButton = myButton
--------------------------------------------------------------
Note that you can use similar techniques to create a window and an instance of your controller and associate them, you'll want the "Creating Windows" section of the NSWindow Class Reference, and the initWithWindow: method of NSWindowController
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden