【问题标题】:How to add/modify buttons on the toolbars in UIVideoEditorController?如何在 UIVideoEditorController 的工具栏上添加/修改按钮?
【发布时间】:2014-03-12 10:46:29
【问题描述】:

我正在尝试将按钮添加到 UIVideoEditorController 的底部工具栏。 这可能吗? 我可以在此工具栏上修改/添加按钮吗?

【问题讨论】:

    标签: ios toolbar uivideoeditorcontroller


    【解决方案1】:

    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.

    所以基本上不可能。

    【讨论】:

      【解决方案2】:

      我在这里留下一个可能的解决方案,但请始终牢记 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];
          }
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-09-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-10-04
        相关资源
        最近更新 更多