私はFoursquare、Instagram、DailyBoothなどのアプリケーションで見られるように、Tab Barを上げたアプリを作成しました。私はタブバーの中心にUIButtonを入れて、すべてがOKらしいことを行うには、私のAppDelegateで、ここでのコード:タブバーを上げてdismissModalViewControllerAnimated
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.mainButton = [UIButton buttonWithType:UIButtonTypeCustom];
// set up the mainButton with an image and calculate coordinates
[self.mainButton addTarget:self action:@selector(showMainViewController:) forControlEvents:UIControlEventTouchUpInside];
[self.window addSubview:tabBarController.view];
[self.window addSubview:mainButton];
[self.window makeKeyAndVisible];
}
mainButtonは保持、非アトミック(そのプロパティでAppDelegate.hで定義されています)合成した。 mainButtonを押すことにより
:
- (IBAction) showMainViewController:(id)sender {
[self.mainButton setHidden:YES];
MainViewController *mainVC = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:mainVC];
[self.mainNavController presentModalViewController:nc animated:YES];
[nc release];
[mainVC release];
}
をmainButtonので、私はそれを隠すことにしましたdiplayed残ります。
この時点で私は疑問があります。ボタンを隠さないでください。
の問題は、私はMainViewControllerを却下することを決定したとき、私は結果は私がエーブルていないよということで、私はきちんと働いているならば、私はMainViewController.m に簡単な[self dismissModalViewControllerAnimated:YES];
でそれをやっているかわからない来ますmainButtonを何かのように再表示してください。[self.mainButton setHidden:NO];