- Where Developers Learn, Share, & Build Careers
I started using the storyboard, but looking at a very important difference: every time I navigate back to the storyboard I think a new view controller appears immediately and further. Example: I create two new Xcode projects based on master-extension templates. In Case 1, I use the storyboard and in case I use 2xib.
Generally I expect to treat them equally, but they do not!
In both, DetailViewController.m I add the following method:
- (zero) viewDidApplication: (BOOL) animated {if (xposition == 0) {xposition = 50 ; } And {xposition = xposition + 50; } NSLog (@ "xposition update% d", xposition); }
(I have declared exposure as an "int" instance variable in the header):
When I run the storyboard Yes, and tap and navigate in "DetailViewController" in and out, then my NSLog statement keeps me "xposition update 50".
On the contrary, for the .xib version, I get my expected behavior where every time I navigate in the Extensible Controller and beyond that "status" increases from 50: 50, 100, 150 etc.
How can I fix this storyboard so that it can behave in the same way as the .xib based version specifically, I only intend to install DetailViewController once.
EDIT: Answering my own question I got some help from this and wanted to post the reply which used to work for me.
When you first store the destination view controller in an asset (see method "PrepareForSegue". My VC is called MyViewController)
After that the "ShouldPerformSegueWithIdentifier" representative Use the method and use it to block the Segment, and then to manually present the stored ViewController for all segments.
- Prepare (zero) ForSegue: (UIStoryboardSegue *) Segu sender: (ID) sender {UIViewController * destination = segue.destinationViewController; NSLog (@ "Identifier =% @", [Segue Identifier]); If (([[identifier] is Equalostring: @ "MySague"]) {self.myViewController =) Destination; NSLog (@ "MyViewController Saving for Later Use.");}} - (BOOL) PforformSegueWithIdentifier : (NSString *) Identifier Sender: (ID sender {if ([Identifier is EqualToString: @ "mySegue"]) {If (self.myViewController! = Zero) {NSLog (@ myViewController "); [Automation Navigation Controller Push ViewController: Animated MI View Controller: Yes]; Do not return;} and {return yes;}}
when you come If you navigate back and forth, then your Storyboard has your DetailViewController because it is not kept by anything else, it will be released, this is normal behavior.
If you want to keep this example You have to maintain it in that visual controller and use it again later.
Edit: I think that you solve this problem But here's an example:
Create a leaf To view the controller in your interface, prepare myViewController to see the Fire controller in the SEGEGE method:
- (zero Ready Ready: (UIStoryboardSegue *) Segu Sender: (ID) Sender {[Self Setview Viewer: [Sage Destination Week Controller]]; } It is not leaking memory, your example may leak in some cases. Check out this guide.
The next time it will be checked that the property has already been fixed and if it uses:
- (BOOL) should be PforformSegueWithIdentifier :( NSString *) Identifier Sender: (ID) Sender {if ([My ownViewController]! = Void) {[[Navigation Controller] pushViewController: [MyViewController Animated myself: Yes]; no return; } And {return yes; }}
Comments
Post a Comment