私は理解しようとする日を取ったより良いアニメーション。 次のコードはうまくいき、タブバーを隠します。問題は、近くにあるすべてのUIButtonを引き伸ばすことです。タブバーにカスタムボタンを含める。それが画像の別のレイヤーに触れると、それが伸びます。どのように私はそれを避けるためにコードを修正することができますか?ありがとう
- (void)hideTabBar:(UITabBarController *) tabbarcontroller
{
[UIView animateWithDuration:0.3
delay:0.0f
options:UIViewAnimationCurveLinear
animations:^{
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]] || [view isKindOfClass:[UIImageView class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, 480, view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, 480)];
}
}
}
completion:nil];
}
隠した後:
回答:
回答№1は1それは UIButton
〜ではなく UIImageView
。スクリーンショットから、このボタンのために別の部分に行くことは明らかです。
あなたは条件を変更する必要がありますので、
if([view isKindOfClass:[UIButton class]] || [view isKindOfClass:[UITabBar class]] || [view isKindOfClass:[UIImageView class]])
フレームを設定します。同様にshowメソッドも同様に変更します。