Re: Frame/layout rect
Re: Frame/layout rect
- Subject: Re: Frame/layout rect
- From: Jo Meder <email@hidden>
- Date: Mon, 25 Jan 2010 21:11:41 +1300
Hi Kyle,
On 25/01/2010, at 6:57 PM, Kyle Sluder wrote:
> On Sun, Jan 24, 2010 at 9:24 PM, Jo Meder <email@hidden> wrote:
>> I'm pretty sure I know the answer to this one already, but is anyone aware of a way to get/set the layout rect for a view? Or get a frame rect from a layout rect, that sort of thing? This is the same layout rect we see in IB, which I understand is only available in IB but which I'm hoping is somehow available at runtime as well.
>
> There's no guarantee that the methods that provide the layout
> information will be available outside of the IB plugin. Someone could
> theoretically only provide them in a category which lives in the
> plugin bundle.
Yes, that's pretty much what I was thinking.
>> The reason I'm asking about this is that the Cocoa way of using the frame rect to get and set view bounds makes it very hard to lay out a UI outside of IB, particularly for things like push buttons where the padding below the actual button is much more than padding at the top.
>
> It's difficult because you're supposed to lay it out in IB. Is there a
> specific reason you wish not to?
Yes. A large part of our UI is laid out algorithmically. All the rest is created programatically one way or another.
A number of parts of our UI are actually laid out in IB on the Mac. That way I get to use the guides etc. to assist with the layout. It just so happens I use Carbon nibs for that. After laying out in IB the nib is loaded into an app which loads the nib and then walks the control hierarchy to generate an XML GUI description file, rather like a nib really. Our application can then parse the XML file and the UI is recreated from that. For Windows I usually edit the Mac XML files by hand, or sometimes use IB to do a Windows appropriate layout for something more complex. I haven't yet had an inescapable need to do a similar XML description file generator on Windows.
I can certainly change over to using Cocoa nibs and write a new XML GUI description file generator. Unfortunately it doesn't solve the layout problems of UI which is actually created entirely in code.
Cocoa seems to specifically preclude a set of well established and perfectly valid UI construction techniques. It's very shortsighted. We use native controls to give the best platform specific experience we can. All this was perfectly feasible in Carbon. IB is a great app and I've been using it for years in various ways, but it isn't appropriate for all situations and to make it the only way to lay out UIs without a lot of hassle seems a bit of an API design failure.
Regards,
Jo Meder _______________________________________________
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