Assigning IBOutlet to Objective-C

The Accessorizer code generator has the ability to assign IBOutlets, rather than save them. For example, compare these two generated lines:

@property(nonatomic,retain)IBOutlet UIImageView *backgroundView; @property(nonatomic,assign)IBOutlet UIImageView *backgroundView; 

Why do I need to assign IBOutlets while retaining all other properties?

+6
objective-c iboutlet
source share
3 answers

Use depends on the platform specified in the memory management guide :

"The behavior of the outputs is platform dependent (see" Mac OS X Desktop "and" iPhone "), so the declaration is different:

  For Mac OS X, you should use: @property (assign) IBOutlet UserInterfaceElementClass *anOutlet; For iPhone OS, you should use: @property (nonatomic, retain) IBOutlet UIUserInterfaceElementClass *anOutlet;" 
+15
source share

On the iPhone OS, your submission may be unloaded (in low memory conditions), but if you have a condition that you care about in some of your submission-related submissions, you do not want to lose it. Therefore, you want to save them.

Tell the navigation controller. The root view is unloaded from the low memory warning sent to the controller, but there is a bunch of controller in the stack. When you return to the root, it will reload the view and return your output points to where they were in the same state in which they were.

At least I think this is a technical reason.

But in a more general sense, your dispatcher takes care of these views because he wants to interact with them. And this fact in itself means that you want to preserve and free them when you no longer need. This is just good practice.

+4
source share

IBOutlet defined as nothing. Command-click on a word in Xcode to see its definition.

That is, it is just a hook that knows the interface to display it. I have never seen @property that included an IBOutlet , but I present it for situations like the UIViewController @property view , which should be accessible from IB, but can also be assigned at runtime.

-4
source share

All Articles