在我的iOS应用程序中,我有一个带有UIToolbar控件的媒体播放器。我想让UIBarButtonItem从左侧滑动到UIToolbar上,当我触摸播放器屏幕时。
这是我尝试过的方法,它确实将UIBarButtonItem从左侧添加到了UIToolbar上,但没有动画效果。
这是我尝试过的方法,它确实将UIBarButtonItem从左侧添加到了UIToolbar上,但没有动画效果。
// 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];
非常感谢您的帮助!