Search This Blog

Monday 30 June 2014

Add Event into iphone Calendar

//Add Event kit framework
EventKit.framework
//import 
#import <EventKit/EventKit.h>

//Copy below code and enjoy

-(IBAction)AddEvent:(id)sender
{
    NSString *dateString = @"Jul 09,2014 00:00";
    
    //Create a formater
    NSDateFormatter *formater =[[NSDateFormatter alloc] init];
    [formater setDateFormat:@"MMM dd,yyyy HH:mm"];
    NSDate *startDate =[formater dateFromString:dateString];
    
    NSLog(@"current date %@",[NSDate date]);
    EKEventStore *store = [[EKEventStore alloc] init];
    [store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
        if (!granted) { return; }
        EKEvent *event = [EKEvent eventWithEventStore:store];
        event.title = @"My Birthday";
        event.startDate = startDate;//[NSDate date]; //today
        event.endDate = [event.startDate dateByAddingTimeInterval:60*60];  //set 1 hour meeting
        [event setCalendar:[store defaultCalendarForNewEvents]];
        NSError *err = nil;
        [store saveEvent:event span:EKSpanThisEvent commit:YES error:&err];
        NSString *savedEventId = event.eventIdentifier;  //this is so you can access this event later
    }];
    

}

Friday 6 June 2014

Convert mp3 to caf format


Open terminal and go to the folder where your mp3 file is placed then write below command and enter 

afconvert -f caff -d LEI16@44100 song.mp3 song.caf

Thats all 

Thursday 5 June 2014

Download Manager for iOS

Small effort by ideamakerz.
This download manager uses the iOS 7 NSURLSession api to download files.
  1. Can download files if app is in background.
  2. Can download multiple files at a time.
  3. It can resume interrupted downloads.
  4. User can also pause the download.
  5. User can retry any download if any error occurred during download.


You can download this amazing tool for your development from here.
Install in your device from here.


Tuesday 3 June 2014

How to right function in swift language

func whatsYourStatus (age:Int, name:String) ->(String)
{
    var answer=""
   
    if(age < 0)
    {
        answer = "you need to born first!"
    }
    else if(age < 13)
    {
        answer = "you are not ready for programing"
    }
    else if(age >= 13 && age <= 19)
    {
        answer = "you can start programing"
    }
    else if(age > 19 && age <= 25)
    {
        answer = "you are an expert of Objective-C"
    }
    else if(age > 25 && age <= 30)
    {
        answer = "you are not ready for swift"
    }
    else if(age > 30 && age <= 35)
    {
        answer = "you are an expert of swift"
    }
    else if(age > 35)
    {
        answer="you are retired , have time with your family"
    }
    return "\(name) \(answer)"
}

whatsYourStatus(45, "Kareem")