Changing leftBarButtonItem with flip transition?

别来无恙 提交于 2019-12-04 13:05:44

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

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

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

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

[flipView addSubview:<original view>];

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];

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.

Hope this helps!

Nick.

Take a look at the Elements sample. They are doing a flip in a toolbar there.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!