MPMoviePlayerController with a Custom Button on its toolbar

后端 未结 2 1149
南笙
南笙 2021-02-06 16:10

You might have seen video through you tube in iPhone.

Normal MPMoviePlayerController has previous, next & play/pause buttons.

You tube - player has additiona

相关标签:
2条回答
  • 2021-02-06 16:38

    I don't think you can modify the interface of an Apple provided view.
    The general approach would be to play your video and then after it's done, show a view with the desired buttons/and or options for the user.

    An example of this can be seen with the YouTube app on the iPhone. After the youtube video plays, the user is sent to a summary view with links to watch the video again, favourite it, share it, etc.

    0 讨论(0)
  • 2021-02-06 16:50

    I would say that it may be possible to just set the MPMoviePlayerController's movieControlMode property to MPMovieControlModeHidden and add a subview to it with your own collection of buttons, titles, etc... But MPMoviePlayerController inherits only from NSObject, so you couldn't do that. Perhaps you can subclass MPMoviePlayerController and setup your own stuff when play is called, yet again, I imagine MPMoviePlayerController would display itself as a modal fullscreen view and hide anything you setup. :-\

    If all you're looking to do is mess with the look of the controls, I DO know that you can mess around with various objects' drawRect: methods to override how bars and buttons are drawn.

    For example, setting up a category or subclass of UINavigationBar and implementing drawRect: as follows will result in a custom navigation bar being drawn:

    - ( void )drawRect:( CGRect )rect
    {
        [ [ UIImage imageNamed:kSTNavigationBarBackgroundImageName ] drawInRect:CGRectMake( 0.0, 0.0, self.frame.size.width, self.frame.size.height ) ];
    }
    

    This replaces Apple's standard look for their navigation bars and replaces it with a custom image asset. We do this, among other things, for our apps.

    0 讨论(0)
提交回复
热议问题