ios - Loading a nib file within a nib file -
I have setup a nib file to include some basic UIView elements within a large UIView element, two elements UIImageView class There are sub-classes (user to display data to the meter) Anyway, in my mind, I want to make these meters as my nib file because they have a lot of visual elements and for their prudence it is personalized in their own Nib file By form I would also like to see a controller for meter and other basic elements in the original nib file. I have set up my custom class (called UMeters) as a child meter nib object in parent nibb. I am having difficulty loading the child in the original nibb, when I override the UIMeter initWithCoder method it creates an infinite loop because I am trying to use Loadnibamed to access the child nib file. I have also tried to load the nib from the original controller but loadnibamed it loads the baby both nib and nibb. It probably will understand more with code and images:
The UIMeter code is not really sure that I also need it because it causes an infinite loop, but I hope this view It may seem smart enough to load itself, though in some ways it looks reasonable to do so in the controller to see it in the reading of the document.
- (id) initWithCoder: (NSCoder *) aDecoder {self = [super initWithCoder: aDecoder]; If (self) {self = [[[NSBundle mainBundle] loadNibNamed: @ "PowerMeter Week" Owner: Self Option: Zero] First Object]; } Healthy return;
}
In the parent controller, I'm dialing this type of view:
- (zero) loadView {If (! [Self-havlyel loaded]) {GameManufacturer * Menu View = [GameManufacturer] New; MenuView.userEnergy = [[[NSBundle mainBundle] loadNib Named: @ "PowerMeter Week" Owner: Self Option: Zero] First Object]; MenuView.userReactor = [[[NSBundle mainBundle] loadNib nominated: @ "PowerMeter Week" owner: self choice: zero] first object]; _gameMenuView = menuView; // - This file keeps the nib from seeing on the file, but it is not replacing UIMeter in the original nube [menuView.userEnergy setFrame]: CGRactam (0, 0, 20, 20)]; [Menu addubjectview: menuView.userEnergy]; [Self set view: menu view]; }
}
>
, you can check whether you are trying to start the elements with loops, already Unloaded
For example, if you have a view called "label" then
then your initWithCoder will look like this
- (id) initWithCoder: (NSCoder *) aDecoder {self = [super initWithCoder: aDecoder]; if (self) {if (! Self.label) {nib} returns self load;}
Comments
Post a Comment