【发布时间】:2014-03-12 10:46:29
【问题描述】:
我正在尝试将按钮添加到 UIVideoEditorController 的底部工具栏。 这可能吗? 我可以在此工具栏上修改/添加按钮吗?
【问题讨论】:
标签: ios toolbar uivideoeditorcontroller
我正在尝试将按钮添加到 UIVideoEditorController 的底部工具栏。 这可能吗? 我可以在此工具栏上修改/添加按钮吗?
【问题讨论】:
标签: ios toolbar uivideoeditorcontroller
Apple Docs明确提及
Important: The UIVideoEditorController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private; do not modify the view hierarchy. This class does not support modifications to its appearance by use of overlay views.
所以基本上不可能。
【讨论】:
我在这里留下一个可能的解决方案,但请始终牢记 Apple 的警告。在这种情况下,我正在更改工具栏的背景颜色,但它应该适用于您想要的任何修改。
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
[self changeBakcgroundColorOfView:navigationController.topView withColor:[UIColor redColor]];
}
- (void) changeBakcgroundColorOfView:(UIView *)view withColor:(UIColor*)color{
for (UIView *subview in view.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:@"UIToolbar"]) {
UIToolbar *toolbar = (UIToolbar *)subview;
toolbar.backgroundColor = color;
toolbar.barTintColor = color;
}
[self changeBakcgroundColorOfView:subview withColor:color];
}
}
【讨论】: