iphone - Basic Objective-C: Why does this code work? -


question 1)

I have a navigation based application where the second view by clicking on an entry Opens the details of that entry.

It is now working with the following code

  [self.navigationController pushViewController: descriptionController Animated: Yes]; [Self.descriptionController.textView setText: [Details]]; Self.descriptionController.title = [name];  

But, if I change the first and third statements, then for the first time I click on an item, showing the Lorem Ipsum text to the detail view. After the first time, it works as expected, I thought it would be right to do it this way.

Question 2)

In addition to this, my text visual elements are part of the part of the description, so why will it show me Lorem Ipsum for the first time? I have in my controller class for the view:

  @property (nonatomic, retain) IBOutlet UITextView * textView;  

But if I change it in

  @property (nonatomic, copy) IBOutlet UITextView * textView;  

Then it crashes, I do not think this accident will happen, but I am thinking that it only creates new instances which takes no memory for anything Can you explain this?

The issue is that [[UIViewController view] and all its subpages are populated, lazy, either from NIB Or load into the program from the load. Therefore:

  // Details on this point: controller.view == zero & amp; TextView == Zero [self. Navigation controller Push ViewController: animated descriptionController: Yes]; // Details at this point: Controller See and set the text view [self.descriptionController.textView setText: [S description]]; Self.descriptionController.title = [name];  

So if you push swap after other lines (which loads the scene) "

  [self.descriptionController.textView setText: [s Description]]; self.descriptionController.title = [s name]; // Details at this point: controller.view == zero & amp; textView == zero [self-navigation controller pushViewController: descriptionController Animated: Yes]; // on this Point details Controller.View and text view are set  

You are sending set values ​​to zero values ​​(which does not do anything), then its diff With Olt values ​​Loading view.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -