Jakie właściwości syntetyzujemy w xcode 4.4.1
Używam Xcode 4.4.1. Kiedy definiuję@property
lubićUINavigationController
lubNSArray
w pliku .h muszę@synthesize
to w pliku .m. Ale niektóre@property
lubićUITabBarController
lubNSString
Nie muszę@synthesize
aby to działało.
Moje pytanie jest co@property
potrzeba@synthesize
i czego nie trzeba.
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;
}
Kiedy ja@synthesize
UINavigationController
dostajęUINavigationController
iUITabBarController
. Ale kiedy nie@synthesize
UINavigationController
Nie rozumiemUINavigationController
aleUITabBarController
jest wyświetlany.
W obu przypadkach nie@synthesize
UITabBarController
Dzięki