【发布时间】:2014-01-17 21:29:51
【问题描述】:
在我的 iOS 应用程序中,我有一个带有 UIToolbar 控件的媒体播放器。当我触摸播放器屏幕时,我想让 UIBarButtonItem 从左侧滑到 UIToolbar 上。
这是我尝试过的,它确实从左侧添加了 UIBarButtonItem,但没有动画部分。
// create new button
UIBarButtonItem* b = [[UIBarButtonItem alloc] initWithTitle:@"b"
style:UIBarButtonItemStyleBordered
target:self
action:nil];
NSMutableArray* temp = [toolbar.items mutableCopy]; // store the items from UIToolbar
NSMutableArray* newItems = [NSMutableArray arrayWithObject:b]; // add button to be on the left
[newItems addObjectsFromArray:temp]; // add the "old" items
[toolbar setItems:newItems animated:YES];
非常感谢任何形式的帮助!
【问题讨论】:
标签: ios ipad uibarbuttonitem uitoolbar