アニメーションボタン
3143 ワード
主にUIButtonに継承されたクラスで、アニメーション効果がカプセル化されています.次のように使用します.
gitHubのアドレスは以下の通りです.https://github.com/AlexeyBelezeko/TBIconTransitionKit
-(void)uiCofig
{
self.title=@"AnimationButton";
[self.navigationController.navigationBar setBarTintColor:[UIColor lightGrayColor]];
_leftBtn=[TBAnimationButton buttonWithType:UIButtonTypeCustom];
_leftBtn.frame=CGRectMake(0, 0, 20, 20);
_leftBtn.currentState=TBAnimationButtonStateMinus;
[_leftBtn addTarget:self action:@selector(leftItemAction) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithCustomView:_leftBtn];
_rightBtn=[TBAnimationButton buttonWithType:UIButtonTypeCustom];
_rightBtn.frame=CGRectMake(0, 0, 15, 25);
_rightBtn.currentState=TBAnimationButtonStateMenu;
_rightBtn.lineColor=[UIColor orangeColor];
[_rightBtn addTarget:self action:@selector(rightItemAction) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithCustomView:_rightBtn];
}
-(void)leftItemAction
{
if (_leftBtn.currentState==TBAnimationButtonStateMinus) {
_leftBtn.currentState=TBAnimationButtonStatePlus;
}else{
_leftBtn.currentState=TBAnimationButtonStateMinus;
}
}
-(void)rightItemAction
{
if (_rightBtn.currentState==TBAnimationButtonStateMenu) {
_rightBtn.currentState=TBAnimationButtonStateArrow;
}else{
_rightBtn.currentState=TBAnimationButtonStateMenu;
}
}
gitHubのアドレスは以下の通りです.https://github.com/AlexeyBelezeko/TBIconTransitionKit