iphone - Loading .xibs into a UIView -


I have a UIViewController that is with .xib of my own, and I use UISegmentedControl to apply the bottom half I want to display different information in the screen. I have created a UIView in the .xib of the container and it is connected to the UIViewController in the container by a UIView property named detailView .

Then I created three .xib files in the IB, for one see that each section needs to be displayed in the detailView field.

Now I'm stuck because I do not know that the Detail View field to load and load the appropriate .xib file. Here is where I am:

  - (zero) SegmentWall Change: (ID) sender {switch ([sender selected index of partition}) {case 0: // Details of whatever , Expand View UIView and // Load AddressView.xib in breaking the file; Case 1: // Load whatever is in the extension and // load it into the ContactsView.xib file; Case 2: // Open whatever, view the details in the UIView and load it in the NotesView.xib file // Load it; Default: Break; }}  

How do I fill the spaces and load the load / load View UIView properly?

Thank you!

- UPDATE- -

Codedload in view is now: - (zero) viewDidload {[Super Viewedload];

  // Set default details after the default setting is set to know Determined index 0. NSArray * nibObjects = [[NSBundle mainBundle] loadNib Nominated: @ "Addressview" owner: Own option : Zero]; Assuming the view, there is only one top-level object in the Nib file (in addition to the file owner and First Responder), UIView * nibView = [nibObjects objectAtIndex: 0]; Self.detailView = nibView; Self.detailContainerView.autoresizesSubviews = Yes; [Self.detailContainerView addSubview: self.detailView]; NSLog (@ "self.view is% @", self.view); NSLog (@ "self.detailContainerView% @", self.detailContainerView); NSLog (@ "self.detailView% @", self.detailView); }  

and debugger messages are:

  self.view is UIView: 0x3a24d80; Frame = (0; 320 460); Autoresc = RM + BM; Layer = CALayer: 0x3a35190 Self-Dopptive Containerviews UIView: 0x3a1aea0; Frame = (20 57; 280 33 9); Autoresiz = wh; H; Layer = CALayer: 0x3a36b80 Self Discriptive UIView: 0x3a24d80; Frame = (0; 320 460); Autoresc = RM + BM; Layer = CALayer: 0x3a35190  

Thanks!

Use NSBundle loadNibNamed: owner: option: . It gives an array of all the top-level objects in the NIB file, which you can then specify your equation. If you want to differentiate between multiple objects in the array, give each one a unique tag in the IB.

Try it:

  Case 0: [[NSBundle mainBundle] loadNibNamed: @ "Addressview" owner: self choice: zero]; break; ...  

If you have specified your view controller as the owner of the file in the Address Builder for AddressView.xib, and the view controller's description is connected to the XIB If the connection is made, call and call to load should be between self.detailView (because you have specified yourself as the owner).

If that does not work, try something like this:

Case 0: NSARRA * Nib Objects = [[NSBindal Main Bundle] LoadNIB Nominated: @ "Address Weaver "owner: Self-options: Nile]; Assuming the view, there is only one top-level object in the Nib file (in addition to the file owner and First Responder), UIView * nibView = [nibObjects objectAtIndex: 0]; Self.detailView = nibView; break; ...

Do this for all cases in the switch statement. If you have declared the detail code as @property (retain) , then self.detailView = ... assignments to issue any previously loaded ideas Will take care of There is no need to unload NIB content specifically.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -