Show In-Call Status Bar by simulating audio recording

December 3, 2014

    AVAudioSession *audioSession = [AVAudioSession sharedInstance];

    NSError *err = nil;

    [audioSession setCategory :AVAudioSessionCategoryPlayAndRecord error:&err];

    if(err){

        NSLog(@”audioSession: %@ %ld %@”, [err domain], (long)[err code], [[err userInfo] description]);

        return;

    }

    [audioSession setActive:YES error:nil];

    NSDictionary *dictionaryRecordSettings = @{

                                               AVFormatIDKey : @(kAudioFormatMPEG4AAC),

                                               AVEncoderAudioQualityKey: @(AVAudioQualityLow),

                                               AVNumberOfChannelsKey: @1,

                                               AVSampleRateKey: @22050.0f

                                               };

    

    self.audioRecorder = [[AVAudioRecorder alloc] initWithURL:[NSURL fileURLWithPath:@”/dev/null”] settings:dictionaryRecordSettings error:nil];

    if(self.audioRecorder

       && audioSession.inputAvailable){

        [self.audioRecorder record];

    }

Take screenshot of an UIView

November 27, 2014

    UIGraphicsBeginImageContextWithOptions(self.ViewToPrint.frame.size, self.ViewToPrint.opaque, (iPhone6 || iPhone6Pluse)?3.0:2.0);

    CGContextClipToRect (UIGraphicsGetCurrentContext(), self.ViewToPrint.bounds);

    [self.ViewToPrint.layer renderInContext:UIGraphicsGetCurrentContext()];

    UIImage *screenshotImage = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

What is Metal Framework?

November 7, 2014

Metal is Apple’s new graphics technology in iOS 8 that allows developers to improve graphics performance by offering “the lowest-overhead access to the GPU.”

How to use UIActivityItemProvider & UIActivityItemSource

November 4, 2014
  1. Subclass “UIActivityItemProvider”
    .h file

    #import <UIKit/UIKit.h>

    @interface SampleActivityItemProvider : UIActivityItemProvider <UIActivityItemSource>

    @end

    .m file

    #import “SampleActivityItemProvider.h”

    @implementation SampleActivityItemProvider

    - (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType {

        if ( [activityType isEqualToString:UIActivityTypeMail] )

            return @””;

        return @”Subject for other than email activities”;

    }

    - (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController {

        return @””;

    }

    - (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType {

        if ( [activityType isEqualToString:UIActivityTypeMail] ) {

            return @”Email Subject”;

        }

        return nil;

    }

    @end

  2. Add the subclass as an activity item

    self.sampleActivityItemProvider = [[SampleActivityItemProvider alloc] init];

    NSArray *activityItem = @[self.sampleActivityItemProvider,[UIImage imageNamed:@”sample.png”]];

    self.sampleActivityController = [[UIActivityViewController alloc] initWithActivityItems:activityItem applicationActivities:nil];

        [self presentViewController:self.sampleActivityController animated:YES completion:nil];

Search ranges of particular character set

August 7, 2014

- (NSArray *)rangesOfNumbersInString:(NSString *)str {

    NSCharacterSet *cs = [NSCharacterSet decimalDigitCharacterSet];

    NSMutableArray *results = [NSMutableArray array];

    NSRange searchRange = NSMakeRange(0, [str length]);

    NSRange range;

    while ((range = [str rangeOfCharacterFromSet:cs options:0 range:searchRange]).location != NSNotFound) {

        [results addObject:[NSValue valueWithRange:range]];

        searchRange = NSMakeRange(NSMaxRange(range), [str length] – NSMaxRange(range));

    }

    return results;

}

NotificationCenter.Framework

August 2, 2014
  1. NCWidgetController
  2. NCWidgetListViewController & NCWidgetListViewDelegate
  3. NCWidgetSearchViewController & NCWidgetSearchViewDelegate
  4. NCWidgetProviding

Right to be forgotten

August 2, 2014
  • The right to be forgotten could make Facebook and Google, for example, liable for up to two percent of their global income if they fail to remove photos that people post about themselves and later regret, even if the photos have been widely distributed already.
  • The concept stems from the desire of an individual to ‘determine the development of his life in an autonomous way, without being perpetually or periodically stigmatized as a consequence of a specific action performed in the past

Firmware Vs OS

August 1, 2014

Firmware refers to a small piece of code that resides in non-volatile memory. In hardware peripherals that are commonly found in offices these days (e.g. printers, VoIP phones, etc.), firmwares are usually responsible for loading (e.g. OS code signature verification) and managing (e.g. flashing OS in recovery mode) the operating systems that is installed on the machine. It’s the operating system’s job to carry out the actual task (e.g. printing).

Continuous Integration in Mobile app development

July 26, 2014

Continuous Integration (CI) – the practice of automating builds and testing is a staple of modern application development. By automating the build process and running the tests on a regular basis, you improve the quality of your application and free up valuable time to concentrate on writing a better user experience.

Why Apple Rocks (1) – Gyroscopes

May 22, 2014

Even premium handsets like the Samsung S4 had gyroscopes that either worked badly or were even faked by mixing accelerometer and compass data

At the same time, Ballet company & iPhone gyroscope teach couples some new dance moves

Ref: http://9to5mac.com/2014/05/21/ballet-company-iphone-gyroscope-teach-couples-some-new-dance-moves/


Follow

Get every new post delivered to your Inbox.