gpt4 book ai didi

ios - 信息灯按钮动画

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:46:18 25 4
gpt4 key购买 nike

我在显示 infobutton 以导航到信息页面/ View 时遇到问题。

这段代码是我写的。

UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
UIBarButtonItem *infoButtonItem = [[UIBarButtonItem alloc] initWithCustomView:infoButton];
toolBar.items = [NSArray arrayWithObjects:infoButtonItem, nil];

我有 infolight 按钮,但我现在不知道如何使用动画和导航操作方法来翻转到信息页面。

我也希望 infobutton 保持在中间,目前它在左下角。

最佳答案

This will create ur info button in center.
UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
UIBarButtonItem *infoButtonItem = [[UIBarButtonItem alloc] initWithCustomView:infoButton];
[infoButton addTarget:self action:@selector(goToRechercherView) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *flexibleLeft = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
toolbar.items = [NSArray arrayWithObjects:flexibleLeft,infoButtonItem,flexibleLeft, nil];


This is for swipe animation. add your view inside.
-(void)goToRechercherView{
[UIView beginAnimations:@"flipview" context:nil];
[UIView setAnimationDuration:2];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
forView:self.view cache:YES];
[UIView commitAnimations];
}

关于ios - 信息灯按钮动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14019329/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com