Welche Eigenschaften synthetisieren wir in xcode 4.4.1?
Ich benutze Xcode 4.4.1. Wenn ich definiere@property
mögenUINavigationController
oderNSArray
in .h Datei muss ich@synthesize
es in .m Datei. Aber einige@property
mögenUITabBarController
oderNSString
Ich muss nicht@synthesize
es, damit es funktioniert.
Meine Frage ist was@property
s müssen@synthesize
und was muss nicht.
AppDelegate.h
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
UITabBarController *_tabBar;
UINavigationController *_navBar;
}
@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, retain) Employee *empView;
@property (nonatomic, retain) UITabBarController *_tabBar;
@property (nonatomic, retain) UINavigationController *_navBar;
AppDelegate.m
@implementation AppDelegate
@synthesize _navBar;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
Employee *emp = [[Employee alloc]initWithNibName:@"Employee" bundle:nil];
self._tabBar = [[UITabBarController alloc]init];
self._navBar = [[UINavigationController alloc]initWithRootViewController:emp];
self._tabBar.viewControllers = [NSArray arrayWithObjects:_navBar, nil];
self.window.rootViewController = self._tabBar;
self._navBar.navigationBar.tintColor = [UIColor brownColor];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
Wenn ich@synthesize
UINavigationController
Ich bekommeUINavigationController
undUITabBarController
. Aber wenn ich es nicht tue@synthesize
UINavigationController
Ich verstehe nichtUINavigationController
aberUITabBarController
wird angezeigt.
In beiden Fällen habe ich nicht@synthesize
UITabBarController
Vielen Dank