What is the best Core Image filter to produce black and white effects?

– (UIImage *)imageBlackAndWhite { CIImage *beginImage = [CIImage imageWithCGImage:self.CGImage]; CIImage *blackAndWhite = [CIFilter filterWithName:@”CIColorControls” keysAndValues:kCIInputImageKey, beginImage, @”inputBrightness”, [NSNumber numberWithFloat:0.0], @”inputContrast”, [NSNumber numberWithFloat:1.1], @”inputSaturation”, [NSNumber numberWithFloat:0.0], nil].outputImage; CIImage *output = [CIFilter filterWithName:@”CIExposureAdjust” keysAndValues:kCIInputImageKey, blackAndWhite, @”inputEV”, [NSNumber numberWithFloat:0.7], nil].outputImage; CIContext *context = [CIContext contextWithOptions:nil]; CGImageRef cgiimage = [context createCGImage:output fromRect:output.extent]; //UIImage *newImage = [UIImage imageWithCGImage:cgiimage]; UIImage *newImage … Read more

How Nike+ GPS on iPhone receives accelerometer updates in the background?

For the sake of providing an answer to this question, even though it is already self answered… “If you use the newer Core Motion API, you can receive updates in the background.” Here is an example: – (void)startAccelerationCollection { [self.motionManager startAccelerometerUpdatesToQueue:[[NSOperationQueue alloc] init] withHandler:^(CMAccelerometerData *data, NSError *error) { dispatch_async(dispatch_get_main_queue(), ^{ [self.accelerometerReadings addObject:data]; }); }]; }

How to Change App name in iTunes Connect

After some confusion I managed to change my app name (while it was in status ‘Prepare for Upload’ – not sure if this works for other statuses): Log in to Itunes Connect Click “Manage applications” Click on your app Click “View details” under your current version Click on Edit next to “Metadata and Uploads” And … Read more

Modal view controller won’t dismiss itself

Dude, I ran into the same problem.. and here is what I found about using parentViewController: Note that as of 5.0 this no longer will return the presenting view controller. This was written in the header file of UIViewController… I am using ShareKit, and the modalViewController was working perfectly in iOS4, but in iOS5, it … Read more

AVURLAsset getting video size

Resolution in Swift 3: func resolutionSizeForLocalVideo(url:NSURL) -> CGSize? { guard let track = AVAsset(URL: url).tracksWithMediaType(AVMediaTypeVideo).first else { return nil } let size = CGSizeApplyAffineTransform(track.naturalSize, track.preferredTransform) return CGSize(width: fabs(size.width), height: fabs(size.height)) } For Swift 4: func resolutionSizeForLocalVideo(url:NSURL) -> CGSize? { guard let track = AVAsset(url: url as URL).tracks(withMediaType: AVMediaType.video).first else { return nil } let size … Read more

self.delegate respondsToSelector: … does not compile

-respondsToSelector: is a method on NSObject. Either assume that your id delegate is in fact an NSObject, and cast it: [(NSObject*)self.delegate respondsToSelector:@selector(myClass:willDoSomething:)] Or, better, make your delegate explicitly an NSObject: @property (nonatomic, weak) NSObject<MyClassDelegate>* delegate; Or make the protocol be a sub-protocol of NSObject: @protocol MyClassDelegate <NSObject>