How to use NSNotification in following scenario (IPhone SDK)? -
considering real life situation, suppose have assigned work 3 people(say person a, person b, person c), instead of waiting them complete task each, want when each person completes assigned tasks, he/she notify me distinctly. can take further decision based on his/her task.
i want implement situation in code, out using separate thread , delegates, mean using nsnotification.
how can stuff programming, can u solve above situation using code (iphone sdk-objective c)?
[[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(mymoviefinishedcallback:) name:mpmovieplayerplaybackdidfinishnotification object:self.movieplayer.movieplayer]; - (void)mymoviefinishedcallback:(nsnotification*)anotification { // release movie instance created in playmovieaturl mpmovieplayercontroller *themovie = [anotification object]; [[nsnotificationcenter defaultcenter] removeobserver:self name:mpmovieplayerplaybackdidfinishnotification object:themovie]; [[nsnotificationcenter defaultcenter] removeobserver:self name:uideviceorientationdidchangenotification object:themovie]; [themovie stop]; [themovie.view removefromsuperview]; }
like can use nsnotification. hope understand.
Comments
Post a Comment