I want to put on the screen a pseudo-UIAlertView which is just a UIView plus buttons in a nib I've created with IB.... what's the best way of doing this?
+1
A:
Create a UIViewController in Xcode and have it create the Xib. Add/Edit the controls in IB. Then load your view controller. Retain it in the class where you're creating it and then add its view as a subview of your calling class. Something like:
PseudoAlertViewController *controller = [[PseudoAlterViewController alloc] init];
[self setAlertViewController:controller]; // nonatomic, retained ivar
[[self view] addSubview:[controller view]]; //assume calling from view controller
[controller release], controller = nil;
When you add the view to your subview it will just add it at the view origin unless you set the frame, so do that as well before adding it to the view hirarchy:
// You'll have to calculate centeredFrame
[[controller view] setFrame:centeredFrame];
Matt Long
2010-08-17 17:16:49