Saturday, 24 April 2010

Resolved Set View Controller to nil


i have table view when clicked, pushes different view controller , streams audio through controller. trying add playing button show when detail view playing audio not set nil. working fine, not sure how controller return nil after movie has finished playing. suggestions?
 

there delegate message, here example code

code:
    - (void) playmovie {	      nsurl *url = [nsurl fileurlwithpath:[[nsbundle mainbundle] pathforresource:@"app intro" oftype:@"mp4"]];        movieplayercontroller = [[mpmovieplayercontroller alloc] initwithcontenturl:url];              // register receive notification when movie has finished playing.        [[nsnotificationcenter defaultcenter] addobserver:self                                                 selector:@selector(movieplaybackdidfinish:)                                                     name:mpmovieplayerplaybackdidfinishnotification                                                   object:movieplayercontroller];        [[nsnotificationcenter defaultcenter] addobserver:self                                                selector:@selector(moviedonepreload:)                                                    name:mpmovieplayerloadstatedidchangenotification                                                  object:movieplayercontroller];            if ([movieplayercontroller respondstoselector:@selector(setfullscreen:animated:)]) {            // use new 3.2 style api            movieplayercontroller.controlstyle = mpmoviecontrolstylenone;             [movieplayercontroller.view setframe:cgrectmake(0, 0, 1024, 748)];          [self.view insertsubview:movieplayercontroller.view belowsubview:masqueview];          [movieplayercontroller play];      }         }    - (void) movieplaybackdidfinish:(nsnotification*)notification {       mpmovieplayercontroller *movieplayer = [notification object];        [[nsnotificationcenter defaultcenter] removeobserver:self                                                        name:mpmovieplayerplaybackdidfinishnotification                                                      object:movieplayer];              // if movieplayer.view added view, needs removed        if ([movieplayer respondstoselector:@selector(setfullscreen:animated:)]) {            [uiview animatewithduration:0.4 animations:^{              movieplayer.view.alpha = 0.0;          }];          [self performselector:@selector(removeaftertime:) withobject:movieplayer.view afterdelay:0.4];       }          }    
not sure if need alot of explenation, let me know when have more questions :)

(instead of performselector, can "popviewcontroller" on navigationcontroller)
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment