Sunday, September 6, 2015

iOS : Script for creating debug and release build folder

# START script for debugLib,releaselib device and simulator


if [ "${ACTION}" = "clean" ]
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphoneos clean
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphonesimulator clean

if [ "${ACTION}" = "build" ]
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphoneos
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphonesimulator



echo "Creating library..."
if [ "${CONFIGURATION}" = "Release" ]
rm -rf "${PROJECT_DIR}/build/${CONFIGURATION}-iphoneos"
rm -rf "${PROJECT_DIR}/build/lib${LIB_TARGET_NAME}.build"
rm -rf "${PROJECT_DIR}/build/${CONFIGURATION}-iphonesimulator"

# END script for debugLib,releaselib device and simulator

Create local notification in iOS

LocalNotification.h file :

#import <Foundation/Foundation.h>

@interface LocalNotification : NSObject

+ (LocalNotification*)standardLocalNotification;

- (void)scheduleAlert:(NSString*)alertBody;

- (void)scheduleAlert:(NSString*)alertBody fireDate:(NSDate*)fireDate;


LocalNotification.m file :

#import <UIKit/UIKit.h>
#import "LocalNotification.h"

static LocalNotification*   localNotification = nil;

@interface LocalNotification(){
    UIApplication* application;


@implementation LocalNotification

- (void)dealloc{
    [super dealloc];

- (instancetype)init{
    self = [super init];
    if (self) {
        application = [UIApplication sharedApplication];
    return self;

+ (LocalNotification*)standardLocalNotification {

    @synchronized(self) {
        if(nil == localNotification) {
            localNotification = [LocalNotification alloc];
    return localNotification;

- (void)scheduleAlert:(NSString*)alertBody {

    [self scheduleAlert:alertBody fireDate:[[NSDate date] dateByAddingTimeInterval:1]];

- (void)scheduleAlert:(NSString*)alertBody fireDate:(NSDate*)fireDate{

    UILocalNotification* localNotification = [[UILocalNotification alloc] init];

    localNotification.fireDate = fireDate;
    localNotification.timeZone = [NSTimeZone systemTimeZone];
    localNotification.repeatInterval = 0;
    localNotification.soundName = UILocalNotificationDefaultSoundName;
    localNotification.alertBody = alertBody;

    [application scheduleLocalNotification:localNotification];
    [localNotification release];


Monday, June 8, 2015

ForHire app Disclaimer


- Information contained in this app is for general information purpose only.

- Information is provided by ForHire app and while we endeavour to keep the information upto date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to information, products, services or related graphics contained in the app.

- Any reliance you place on such information is therefore strictly at your own risk.

- In no event will we be liable for any loss or damage including with our limitation, indirect or consequential loss or damage arising from use of this app.

- Every effort is made to keep the app content accurate. However, owner/developer of app takes no responsibility for, and will not be liable for any technical issues.

- Copyright © 2015 Semicolon Technologies. All Rights Reserved.
  Any dispute subject to Mumbai Jurisdiction.

Tuesday, May 19, 2015

Status bar overlap view in iOS 7 and above

- (void) viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
        CGRect screen = [[UIScreen mainScreen] bounds];
        if (self.navigationController) {
            CGRect frame = self.navigationController.view.frame;
            frame.origin.y = 20;
            frame.size.height = screen.size.height - 20;
            self.navigationController.view.frame = frame;
        } else {
            if ([self respondsToSelector: @selector(containerView)]) {
                UIView *containerView = (UIView *)[self performSelector: @selector(containerView)];

                CGRect frame = containerView.frame;
                frame.origin.y = 20;
                frame.size.height = screen.size.height - 20;
                containerView.frame = frame;
            } else {
                CGRect frame = self.view.frame;
                frame.origin.y = 20;
                frame.size.height = screen.size.height - 20;
                self.view.frame = frame;
Add this to make your status bar white just right after the  [self.window makeKeyAndVisible];  in App delegate file
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

Wednesday, February 25, 2015

Create animation for set of Images

 // The root view of the view controller set in Interface Builder is a UIImageView.
    UIImageView *imageView = (UIImageView *)self.view;
    imageView.animationImages = @[
                          [UIImage imageNamed:@"image_animal_1"],
                          [UIImage imageNamed:@"image_animal_2"],
                          [UIImage imageNamed:@"image_animal_3"],
                          [UIImage imageNamed:@"image_animal_4"],
                          [UIImage imageNamed:@"image_animal_5"]
    // We want the image to be scaled to the correct aspect ratio within imageView's bounds.
    imageView.contentMode = UIViewContentModeScaleAspectFit;
    // If the image does not have the same aspect ratio as imageView's bounds, then imageView's backgroundColor will be applied to the "empty" space.
    imageView.backgroundColor = [UIColor whiteColor];
    imageView.animationDuration = 5;
    [imageView startAnimating];
    imageView.isAccessibilityElement = YES;

    imageView.accessibilityLabel = NSLocalizedString(@"Animated", nil);

ActionSheet using UIAlertController

// Show a dialog with an "Okay" and "Cancel" button.
- (void)showOkayCancelActionSheet:(NSIndexPath *)selectedPath {
    NSString *cancelButtonTitle = NSLocalizedString(@"Cancel", nil);
    NSString *destructiveButtonTitle = NSLocalizedString(@"OK", nil);
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    // Create the actions.
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
        NSLog(@"The \"Okay/Cancel\" alert action sheet's cancel action occured.");
    UIAlertAction *destructiveAction = [UIAlertAction actionWithTitle:destructiveButtonTitle style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
        NSLog(@"The \"Okay/Cancel\" alert action sheet's destructive action occured.");
    // Add the actions.
    [alertController addAction:cancelAction];
    [alertController addAction:destructiveAction];
    // Configure the alert controller's popover presentation controller if it has one.
    UIPopoverPresentationController *popoverPresentationController = [alertController popoverPresentationController];
    if (popoverPresentationController) {
        UITableViewCell *selectedCell = [self.tableView cellForRowAtIndexPath:selectedPath];
        popoverPresentationController.sourceRect = selectedCell.frame;
        popoverPresentationController.sourceView = self.view;
        popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
    [self presentViewController:alertController animated:YES completion:nil];


Alert using UIAlertController (TextField and Two buttons)

// Show a text entry alert with two custom buttons.
- (void)showTextEntryAlert {

    NSString *title = NSLocalizedString(@"Short_title", nil);
    NSString *message = NSLocalizedString(@"Message", nil);
    NSString *cancelButtonTitle = NSLocalizedString(@"Cancel", nil);
    NSString *otherButtonTitle = NSLocalizedString(@"OK", nil);
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
    // Add the text field for text entry.
    [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
        // If you need to customize the text field, you can do so here.
    // Create the actions.
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
        NSLog(@"The \"Text Entry\" alert's cancel action occured.");
    UIAlertAction *otherAction = [UIAlertAction actionWithTitle:otherButtonTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
        NSLog(@"The \"Text Entry\" alert's other action occured.");
    // Add the actions.
    [alertController addAction:cancelAction];
    [alertController addAction:otherAction];
    [self presentViewController:alertController animated:YES completion:nil];


Create Attribute Text button

- (void)configureAttributedTextSystemButton {
    // Set the button's title for normal state.
    NSDictionary *normalTitleAttributes = @{
               NSForegroundColorAttributeName: [UIColor customBlueColor],
               NSStrikethroughStyleAttributeName: @(NSUnderlineStyleSingle)
    NSAttributedString *normalAttributedTitle = [[NSAttributedString alloc]
               initWithString:NSLocalizedString(@"Button", nil)

    [self.attributedTextButton setAttributedTitle:normalAttributedTitle 
    // Set the button's title for highlighted state.
    NSDictionary *highlightedTitleAttributes = @{                                                         
             NSForegroundColorAttributeName : [UIColor customGreenColor],                                                
             NSStrikethroughStyleAttributeName: @(NSUnderlineStyleThick)
    NSAttributedString *highlightedAttributedTitle = [[NSAttributedString
            alloc] initWithString:NSLocalizedString(@"Button", nil)        

    [self.attributedTextButton setAttributedTitle:highlightedAttributedTitle
    [self.attributedTextButton addTarget:self   


Tuesday, January 27, 2015

Animate images in UIImageView


   UIImageView *imgview = [[UIImageView alloc]      
    initWithFrame:CGRectMake(10, 10, 300, 400)]; // set an animation 

   imgview.animationImages = [NSArray arrayWithObjects: [UIImage 
       imageNamed:@"AppleUSA1.jpg"], [UIImage   
       imageNamed:@"AppleUSA2.jpg"], nil]; 

   imgview.animationDuration = 4.0; 
   imgview.contentMode = UIViewContentModeCenter; 
   [imgview startAnimating]; 
   [self.view addSubview:imgview]; 

Hide status bar programmatically with animation


      [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; 

      [UIView beginAnimations:@"Statusbar hide" context:nil]; 
      [UIView setAnimationDuration:0.5]; 

      [self.view setFrame:CGRectMake(0, 0, 320, 480)]; 
      [UIView commitAnimations]; 

- (void)viewDidLoad { 
      [super viewDidLoad]; // hideStatusbar called after 2 seconds 
      [self performSelector:@selector(hideStatusbar) withObject:nil