[Objc] Change controller on application background

Yes, you can!
Now you are able to change the of your app while is in !

An example here:


 

How to?

Make a new project, and in your AppDelegate.m, consider the system methods:

- (void):(UIApplication *)application {
	// to add your background controller
	[self applySnapshot];
}

- (void):(UIApplication *)application {
	// to remove your background controller
	[self removeSnapshot];
}

Next, add in applicationWillResignActive method the “applySnapshot” and then call “removeSnapshot” to remove it in applicationDidBecomeActive.

Method applySnapshot, make a screenshot of your screen and next apply to the captured image, the  filter to show you the blur effect.
At the bottom of the method there is an image array animated, just to show you the potentiality!

- (void) applySnapshot
{
	 rect = [[UIScreen mainScreen] bounds];
	UIGraphicsBeginImageContext(rect.size);
	[self.window.layer renderInContext:UIGraphicsGetCurrentContext()];
	UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();

	 *imageToBlur = [ imageWithCGImage:viewImage.CGImage];
	 *gaussianBlurFilter = [ filterWithName: @"CIGaussianBlur"];
	[gaussianBlurFilter setValue:imageToBlur forKey: @"inputImage"];
	[gaussianBlurFilter setValue:[NSNumber numberWithFloat: 2] forKey: @"inputRadius"];
	CIImage *resultImage = [gaussianBlurFilter valueForKey: @"outputImage"];

	viewImage = [[UIImage alloc] initWithCIImage:resultImage];

	UIImageView *newView = [[UIImageView alloc] initWithFrame:rect];
	newView.image = viewImage;
	newView.tag = 1234;
	newView.alpha = 0;

	UIImageView *imgv = [[UIImageView alloc] initWithFrame:CGRectMake(50, 50, 200, 200)];
	imgv.animationImages = @[
			[UIImage imageNamed:@"1"],
			[UIImage imageNamed:@"2"],
			[UIImage imageNamed:@"3"]
	];
	imgv.animationDuration = 3;
	[imgv startAnimating];

	[newView addSubview:imgv];

	[self.window addSubview:newView];
	[self.window bringSubviewToFront:newView];

	[UIView animateWithDuration:0.25 animations:^{
		newView.alpha = 1;
	}];
}
- (void) removeSnapshot
{
	UIView *colourView = [self.window viewWithTag:1234];
	[UIView animateWithDuration:0.25 animations:^{
		colourView.alpha = 0;
	} completion:^(BOOL finished) {
		[colourView removeFromSuperview];
	}];
}

Have fun!

thanks.