2

現在、スワイプジェスチャを使用してビューコントローラーを切り替えていますが、uiscrollview を使用せずに各ビューコントローラーに uipagecontrol を実装できるかどうか疑問に思っています。

あるView Controllerから別のView Controllerに移動する方法は次のとおりです。

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.title = @"Home";

    UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc] initWithTitle:@"\u2699" style:UIBarButtonItemStyleBordered target:self action:@selector(settingsButtonPressed:)];
    [settingsButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:24], UITextAttributeFont,nil] forState:UIControlStateNormal];
    self.navigationItem.leftBarButtonItem = settingsButton;

    UIBarButtonItem *systemAction = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(showMenu)];
    self.navigationItem.rightBarButtonItem = systemAction;

    UISwipeGestureRecognizer *swipeRecognizer = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeLeft:)];
    swipeRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
    [self.view addGestureRecognizer:swipeRecognizer];
}

- (IBAction)swipeLeft:(UIGestureRecognizer *)sender
{
    HomeTwo *homeTwo = [[HomeTwo alloc]initWithNibName:@"HomeTwo" bundle:nil];
    homeTwo.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self.navigationController pushViewController:homeTwo animated:YES];
}
4

1 に答える 1