This is a class designed to show a UIImage and blur & shrink the background. Similar to the Facebook app.
MXLMediaView uses UIKit Dynamics for the gravity effect so is only compatible with iOS 7 or newer.
The only externa dependency is on Apple's UIImage+ImageEffects, which is included in this repo.
The process of showing an image in your app is dead simple. First import the class:
#import "MXLMediaView.h"
And then:
-(void)pushShowImageButton:(id)sender {
MXLMediaView *mediaView = [[MXLMediaView alloc] init];
[mediaView setDelegate:self];
[mediaView showImage:[UIImage imageNamed:@"[email protected]"] inParentView:self.view completion:^{
NSLog(@"Done showing MXLMediaView");
}];
}
or to show a video...
-(void)pushShowVideoButton:(id)sender {
MXLMediaView *mediaView = [[MXLMediaView alloc] init];
[mediaView setDelegate:self];
// The best video on the Internet.
NSURL *videoURL = [NSURL URLWithString:@"http://website.com/video.mp4"];
[mediaView showVideoWithURL:videoURL inParentView:self.navigationController.view completion:^{
NSLog(@"Complete");
}];
}
Delegate methods:
-(void)mediaView:(MXLMediaView *)mediaView didReceiveLongPressGesture:(id)gesture {
NSLog(@"MXLMediaViewDelgate: Long pressed received");
}
-(void)mediaViewWillDismiss:(MXLMediaView *)mediaView {
NSLog(@"MXLMediaViewDelgate: Will dismiss");
}
-(void)mediaViewDidDismiss:(MXLMediaView *)mediaView {
NSLog(@"MXLMediaViewDelgate: Did dismiss");
}
MXLMediaView is now installable via CocoaPods!
pod 'MXLMediaView', '~> 1.1'
MIT. See LICENCE file for more info.
If you do use this in your app, send me a tweet!
How much do you think this advanced open source project is worth? Wait just one minute before you answer!
Watch as MXLMediaView shows any image with just the call of a method! Now you can take any image you like and show it right in your app!
That's right, all these features for just... how much did you guess? $500? $1000? Even more?! No! It's just $0. That's right! It's incredible value but it's true! Order today PO Box MXL, GitHub, Chicago - Except in Nebraska...