用翻转过渡改变leftBarButtonItem? [英] Changing leftBarButtonItem with flip transition?

查看:100
本文介绍了用翻转过渡改变leftBarButtonItem?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的代码中,我以编程方式将带有UIButton的leftBarButtonItem更改为UIActivityIndi​​catorView,我想知道如何在更改时执行翻转过渡,任何想法?

In my code I programmatically change leftBarButtonItem with a UIButton to a UIActivityIndicatorView, I would like to know how to perform a flip transition when changing, any idea ?

谢谢很多。

推荐答案

嗯..我觉得要做一个翻转过渡,你需要有一个UIView。

Hmm.. I have a feeling that to do a flip transition, you need to have a UIView.

所以..你可以制作一个自定义barButtonItem并添加一个flipView:

So.. you could make a custom barButtonItem and add to it a flipView:

UIView *flipView = [[UIView alloc] init....];
BarButtonItem *barbutton = [[BarButtonItem alloc] initWithCustomView:flipView];

然后将原始视图添加到flipView,这可以包含您喜欢的任何内容......

then add your original view to the flipView, this can contain whatever you like...

[flipView addSubview:<original view>];

然后将其转换为UIActivityIndi​​catorView,我想你需要做这样的事情:

Then to flip this into a UIActivityIndicatorView, I think you need to do something like this:

[UIView beginAnimations:@"flip" context:NULL];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:flipView cache:YES];

[<original view> removeFromSuperView];
[flipView addSubview:<activityIndicatorView>];

[UIView commitAnimations];

您可能需要在某个地方保留对flipView的引用,以便您可以返回对当你想要执行翻转时。

You'll probably have to keep a reference to your flipView somewhere so you can bring back a reference to it when you want to perform the flip.

希望这会有所帮助!

Nick。

这篇关于用翻转过渡改变leftBarButtonItem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆