私はアニメーションを行うために catransition を使用しました。ボタンをクリックしてから、ビューレイヤーを下からポップアップして画面を覆いたいと思います。次にボタンをもう一度クリックすると、ビューレイヤーが一番下にポップダウンして消えます。私のコードは下にあります。ポップアップ機能は正常に機能しますが、ポップダウン機能はうまく機能しませんでした。私のビューレイヤーが消えたばかりで、ポップダウンアクションが表示されませんでした。誰も私に方法を教えてもらえますか? どうもありがとう
#define HIDE_REG CGRectMake(0,372,0,0)
#define POPUP_REG CGRectMake(0,0,320,372)
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
[otherText setFrame:HIDE_REG];
isPopup = NO;
}
-(void)popup:(NSString *) content
{
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.5f;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.fillMode = kCAFillModeForwards;
animation.type = kCATransitionPush;
animation.subtype = kCATransitionFromRight;
[self.otherText.layer addAnimation:animation forKey:@"animation"];
[self.otherText setFrame:POPUP_REG];
}
-(void)popdown:(NSString *) content
{
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.5f;
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.fillMode = kCAFillModeForwards;
animation.type = kCATransitionPush;
animation.subtype = kCATransitionFromLeft;
[self.otherText.layer addAnimation:animation forKey:@"animation"];
[self.otherText setFrame:HIDE_REG];
}