iOSアプリケーションのタイトルバーを作成しており、これをUIView内で作成しています。私が抱えている唯一の問題は「ホームボタン」です。ホームボタンを押すと、ホームページ(ViewController)に移動する必要があります。
[self presentViewController:vc animated:NO completion:NULL];
ただし、 UIViewで機能するようには見えません。
この問題を回避するにはどうすればよいですか?
- (void) createTitlebar {
CGRect titleBarFrame = CGRectMake(0, 0, 320, 55);
//Create the home button on the top right of the page. When clicked, it will navigate to the home page of the application
homeButton = [UIButton buttonWithType:UIButtonTypeCustom];
homeButton.frame = CGRectMake(275, 10, 40, 40);
[homeButton setTag:1];
[homeButton setImage:[UIImage imageNamed:@"homeIcon.png"] forState:UIControlStateNormal];
[homeButton addTarget:self action:@selector(homeButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:homeButton];
}
- (IBAction)homeButtonPressed:(id)sender{
//Transition to the submit button page
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
ViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:vc animated:NO completion:NULL];
}