Instance Properties and Variables

I am confused why some classes declare a property, but do not declare ivar and vice versa.

Is this standard practice when declaring an instance variable also declares it as a property?

Example:

@interface AppDelegate : NSObject <UIApplicationDelegate>
{
    UIWindow *window;
    UINavigationController *navigationController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;

is standard practice when declaring an ivar class to make it also a property?

I get that @property creates its own elongated setter (and getter with @synethesize), but why should it also be an ivar?

+5
source share
1 answer

This is not true.

, ivars @interface. PPC i386 (.. 32- Intel). , , . , ivars @interface, .

x86_64 ARM obj-c 2.0 . , . . , ivar @property (, @synthesize ). Clang ( @interface ClassName ()) @implementation.

3 , ivars, @interface:

  • ( ), , ivar.
  • , PPC i386.
  • , - , ivars . .

, , ivars (), ivars, , @implementation. , API , . Ivars .

+14

All Articles