J'affiche une nouvelle UIWindow et je veux qu'elle glisse à partir de la gauche et qu'elle glisse dans le côté gauche lorsqu'elle est fermée. Comment puis-je animer l'affichage et la suppression d'une UIWindow?UIWindow Animation de diapositives
Voici comment je montre actuellement mon nouvel UIWindow.
- (void)showMenu
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
UIButton *closeMenuButton = [UIButton buttonWithType:UIButtonTypeCustom];
[closeMenuButton setFrame:CGRectMake(250, 10, 50, 50)];
[closeMenuButton setImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal];
[closeMenuButton addTarget:self action:@selector(closeMenu) forControlEvents:UIControlEventTouchUpInside];
blurredView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight)];
[blurredView setBarStyle:UIBarStyleBlack];
MenuTableViewController *menu = [[MenuTableViewController alloc]initWithNibName:@"MenuTableViewController" bundle:nil];
menu.view.frame = CGRectMake(0, 30, screenWidth, screenHeight - 50);
menuWindow = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
menuWindow.backgroundColor = [UIColor clearColor];
menuWindow.windowLevel = UIWindowLevelStatusBar;
menuWindow.rootViewController = menu;
[menuWindow addSubview:blurredView];
[blurredView addSubview:closeMenuButton];
[blurredView addSubview:menu.view];
[menuWindow makeKeyAndVisible];
}
Peut-être que cela?
menuWindow = [[UIWindow alloc]initWithFrame:CGRectMake(0, 0, 0, screenHeight)];
menuWindow.backgroundColor = [UIColor clearColor];
menuWindow.windowLevel = UIWindowLevelStatusBar;
menuWindow.rootViewController = menu;
[menuWindow addSubview:blurredView];
[blurredView addSubview:closeMenuButton];
[blurredView addSubview:menu.view];
[menuWindow makeKeyAndVisible];
[UIView animateWithDuration:0.5 animations:^{
menuWindow.frame = screenRect;
blurredView.frame = screenRect;
menu.view.frame = CGRectMake(0, 30, screenWidth, screenHeight - 50);
}
completion:^(BOOL finished) {
}];
La fenêtre que je crée s'affiche très bien et fait exactement ce que je veux qu'elle fasse sauf animer du côté gauche de l'écran. – raginggoat
Dans votre code, il n'y a pas d'animation. Postez le code de l'animation pour que je puisse y jeter un coup d'œil. –
L'animation est ce que je ne suis pas sûr de savoir comment faire. – raginggoat