Archive

Monthly Archives: March 2013

I was having troubles showing a simple MPMoviePlayerViewController… digging into stackoverflow everything pointed me to an issue of iOS 6 about rotations, and viewWillAppear/viewWillDisappear methods that are called from the root view controller.

What it actually was… was much more simpler than all this (now… after 2 hours of research..), this stackoverflow answer pointed me to the correct solution

http://stackoverflow.com/a/12950958

I was using

[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:path]];

instead of:

[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]];

This is how it should look like

NSString *path = [[NSBundle mainBundle] bundlePath];

path = [path stringByAppendingPathComponent:@"test.mp4"];

self.moviePlayerViewcontroller = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]];

 

Worst thing…  the error messages: NOTHING AT ALL

Imagine you have a repeating animation created with the UIView block animation method and you want to stop.

So your creation looks like this:

[UIView animateWithDuration:2.0 delay:0.0 
options:(UIViewAnimationOptionRepeat|UIViewAnimationOptionAutoreverse)
animations:^{
    [myImageview setAlpha:1.0];
}completion:^(BOOL finished){
}];

You can just stop this animation by  commiting a fast animation to the final value you want to have, in my case alpha 0

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.1];
[UIView setAnimationCurve: UIViewAnimationCurveLinear];
[myImageview setAlpha:0.0];
[UIView commitAnimations];

source: http://stackoverflow.com/questions/554997/cancel-a-uiview-animation

source that didn’t work for me, as first guess because I am using an UIImageView:

http://stackoverflow.com/questions/7204602/how-to-stop-an-uiview-animation