Xcode 4.4.1 を使用しています。@property likeUINavigationControllerまたはNSArrayin .h ファイルを定義するときは @synthesize、.m ファイルで定義する必要があります。しかし、それを機能させるために@property好きなUITabBarController人NSStringもいれば、必要ない人もい@synthesizeます。
私の質問は、@property必要な@synthesizeものと不要なものです。
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;
}
@synthesize UINavigationController私が得たときUINavigationControllerとUITabBarController. しかし、私が取得しないとき は@synthesize UINavigationController表示されます。UINavigationControllerUITabBarController
どちらの場合も、私はしませんでした@synthesize UITabBarController
ありがとう