Just drag and drop the generic UIView into nib in Interface Builder and set its class to your own subclass. You can still do everything you can with a simple old UIView, including drag and drop objects.
You will not be able to see what a custom preview looks like in the Builder interface; it will be just a gray rectangle. You could (I think) do it in Xcode 3 with IB plugins, but at least as long as Xcode 4 doesn't support such plugins.
EDIT:
To access OP observation, you need to programmatically control z-ordering. It's probably easiest to leave your code basically as it is, but instead of doing something like:
UIView *mySubview1 = ...; UIView *mySubview2 = ...; UIView *mysubview3 = ...; [self addSubview:mySubview1]; [self addSubview:mySubview2]; [self addsubview:mySubview3];
(which, as you noted, may well add routines on top of user subzones)
Do something like:
UIView *container = [[UIView alloc] initWithFrame:[self bounds]]; UIView *mySubview1 = ...; UIView *mySubview2 = ...; UIView *mysubview3 = ...; [container addSubview:mySubview1]; [container addSubview:mySubview2]; [container addsubview:mySubview3]; [self addSubview:container]; [self sendSubviewToBack:container]; [container release];
You can also use [self insertSubview: container atIndex: 0], but I think adding and moving to the back is a little clearer during quick code snippets.
The end result is that you don't have to bother with the existing z-ordering of your subzones; by placing them in one easy-to-manage container, you can move the entire collection to where you would like in the subview hierarchy.
source share