This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)updateMotionData { | |
//1 | |
CMAcceleration acceleration = self.motionManager.deviceMotion.userAcceleration; | |
self.accelerationXVal.text = [NSString stringWithFormat:@"%.3f", acceleration.x]; | |
self.accelerationYVal.text = [NSString stringWithFormat:@"%.3f", acceleration.y]; | |
self.accelerationZVal.text = [NSString stringWithFormat:@"%.3f", acceleration.z]; | |
// | |
//2 | |
CMAcceleration gravity = self.motionManager.deviceMotion.gravity; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "DVViewController.h" | |
#import <CoreMotion/CoreMotion.h> | |
#define kCMDeviceMotionUpdateFrequency (1.f/30.f) | |
@interface DVViewController () | |
@property (weak, nonatomic) IBOutlet UILabel *accelerationXVal; | |
@property (weak, nonatomic) IBOutlet UILabel *accelerationYVal; | |
@property (weak, nonatomic) IBOutlet UILabel *accelerationZVal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DVPlaylistPlayer *player = [[DVPlaylistPlayer alloc] init]; | |
[self.view addSubview:player.playerView]; | |
player.delegate = someDelegate; | |
player.dataSource = someDataSource; | |
[player playMediaAtIndex:0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)blurryImage:(UIImage *)image | |
withBlurLevel:(CGFloat)blur { | |
CIImage *inputImage = [CIImage imageWithCGImage:image.CGImage]; | |
CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur" | |
keysAndValues:kCIInputImageKey, inputImage, | |
@"inputRadius", @(blur), | |
nil]; | |
CIImage *outputImage = filter.outputImage; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)blurryGPUImage:(UIImage *)image | |
withBlurLevel:(NSInteger)blur { | |
GPUImageFastBlurFilter *blurFilter = | |
[[GPUImageFastBlurFilter alloc] init]; | |
blurFilter.blurSize = blur; | |
UIImage *result = [blurFilter imageByFilteringImage:image]; | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)blurryImage:(UIImage *)image withBlurLevel:(CGFloat)blur { | |
if (blur < 0.f || blur > 1.f) { | |
blur = 0.5f; | |
} | |
int boxSize = (int)(blur * 100); | |
boxSize = boxSize - (boxSize % 2) + 1; | |
CGImageRef img = image.CGImage; | |
vImage_Buffer inBuffer, outBuffer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//setting notifiers | |
- (void)setupScreenConnectionNotificationHandlers { | |
NSNotificationCenter* center = [NSNotificationCenter | |
defaultCenter]; | |
[center addObserver:self selector:@selector( | |
handleScreenConnect:) | |
name:UIScreenDidConnectNotification object:nil]; | |
[center addObserver:self selector:@selector( | |
handleScreenDisconnect:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (UIScreen *screen in [UIScreen screens]) | |
{ | |
if ([screen respondsToSelector:@selector(mirroredScreen)] && | |
[screen mirroredScreen] == [UIScreen mainScreen]) | |
{ | |
// The main screen is being mirrored. | |
} | |
else | |
{ | |
// The main screen is not being mirrored, or |