开发者

How to Animate Switching Buttons in Xcode?

开发者 https://www.devze.com 2023-03-13 11:39 出处:网络
I have a button on navigationbar called Map and List When Map is pressed I do - (IBAction)Map:(id)sender {

I have a button on navigationbar called Map and List

When Map is pressed I do

- (IBAction)Map:(id)sender {
    self.tabBarController.navigationItem.rightBarButtonItem =self.List;
    [BNUtilitiesQuick AnimateSwitchingWithParent:SwitchViews From:theTable To:GoogleMapController.view];

}

- (IBAction)List:(id)sender {
    self.tabBarController.navigationItem.rightBarButtonItem =self.Map;
    [BNUtilitiesQuick AnimateSwitchingWithParent:SwitchViews From:GoogleMapController.view To:theTable];

}

Now, curiously, rather than setting self.tabBarController.navigationItem.rightBarButtonItem =self.Map; and make the button split in a jiffy, I think I would like to animate that switch.

How would I do so?

Also how would I animate pu开发者_开发问答shing and poping view to navigation controller? How do I animate users switching tabBar item?


If you check out the UITabBar documentation: UITabBar

- (void)setItems:(NSArray *)items animated:(BOOL)animated

Try making an array of the new tab bar items you want, and set it to the UITabBar

// Assuming "tabBar" is a UITabBar, probably part of a UITabBarController
// Assuming "newItem" is a new UITabBarItem containing the new buttons you want
// animate in.

NSArray* newItemArray = [NSArray arrayWithObjects:newItem,nil];
[tabBar setItems:newItemArray animated:YES];

// This should work, and you can include more than just one new item for multiple
// buttons on the tab bar.

Hope that works for you!

0

精彩评论

暂无评论...
验证码 换一张
取 消