有没有办法旋转UIBarButtonSystemItem Refresh的刷新图标,直到刷新完成?

问题描述 投票:0回答:1

我正在设置UIBarButtonSystemItemRefresh,并希望旋转UIBarButtonSystemItemRefresh的刷新图标,直到刷新完成。我怎样才能做到这一点?

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh)];

- (void)refresh {
    //start rotate the refresh icon animation
}

- (void)done {
    //stop rotate the refresh icon animation
}
ios objective-c animation uibarbuttonitem
1个回答
0
投票

您无法公开访问使用系统项创建的UIBarButtonItem的图标。

您需要创建自己的图标和图像视图,然后使用initWithCustomView:创建条形按钮项。然后,您可以在需要时访问条形按钮项目的customView属性,并将所需的任何动画应用于图像视图。

© www.soinside.com 2019 - 2024. All rights reserved.