Monday, January 09, 2012

iOS versions and their mountain code names

  • 1.0: Alpine
  • 1.1: Little Bear
  • 2.0: Big Bear
  • 2.1: Sugarbowl
  • 2.2: Timberline
  • 3.0: Kirkwood
  • 3.1: Northstar
  • 3.2: Wildcat
  • 4.0: Apex
  • 4.1: Baker
  • 4.2: Jasper
  • 4.3: Durango
  • 5.0: Telluride
  • 5.1: Hoodoo

Tuesday, January 03, 2012

iOS: Adding Contacts Using AddressBook Framework

    ABRecordRef aRecord = ABPersonCreate();
   
    CFErrorRef  anError = NULL;
   
    ABRecordSetValue(aRecord, kABPersonFirstNameProperty,
                      CFSTR("MAHES"), &anError);
    ABRecordSetValue(aRecord, kABPersonLastNameProperty,
                     CFSTR("CHELLAIAH"), &anError);
    ABMutableMultiValueRef multiPhone = ABMultiValueCreateMutable(kABMultiStringPropertyType);
    ABMultiValueAddValueAndLabel(multiPhone, CFSTR("9751050790"), kABPersonPhoneMobileLabel, NULL); 
    ABRecordSetValue(aRecord, kABPersonPhoneProperty, multiPhone,nil);
    CFRelease(multiPhone);
   
    if (anError != NULL) {
       
        NSLog(@"error while creating..");
    }
   
    CFStringRef firstName, lastName;
    firstName = ABRecordCopyValue(aRecord, kABPersonFirstNameProperty);
    lastName  = ABRecordCopyValue(aRecord, kABPersonLastNameProperty);
   
   
    CFErrorRef error = NULL;
    ABAddressBookRef addressBook = ABAddressBookCreate(); 
   
    BOOL isAdded = ABAddressBookAddRecord (
                                           addressBook,
                                           aRecord,
                                           &error
                                           );
   
    if(isAdded){
       
        NSLog(@"added..");
    }
    if (error != NULL) {
        NSLog(@"ABAddressBookAddRecord %@", error);
    }
    error = NULL;
   
    BOOL isSaved = ABAddressBookSave (
                                      addressBook,
                                      &error
                                      );
   
    if(isSaved){
       
        NSLog(@"saved..");
        [self handleCall];
    }
   
    if (error != NULL) {
        NSLog(@"ABAddressBookSave %@", error);
    }
   
    CFRelease(aRecord);
    CFRelease(firstName);
    CFRelease(lastName);
    CFRelease(addressBook);

Thursday, December 29, 2011

Add UIBarButton item into a UIToolBar








UIToolbar *toolbar = [UIToolbar new];
toolbar.barStyle = UIBarStyleBlackTranslucent;
// create a bordered style button with custom title
UIBarButtonItem *facebook = [[[UIBarButtonItem alloc] initWithTitle:@"facebook"
                                 style:UIBarButtonItemStyleBordered   target:self           
                                 action:@selector(fbAction:)] autorelease];

UIBarButtonItem *twitter = [[[UIBarButtonItem alloc] initWithTitle:@"twitter"
                              style:UIBarButtonItemStyleBordered
      target:self
      action:@selector(twAction:)] autorelease];
NSArray *items = [NSArray arrayWithObjects: 
  facebook,
  twitter,
  nil];
toolbar.items = items;
// size up the toolbar and set its frame
        // please not that it will work only for views without Navigation toolbars. 
[toolbar sizeToFit];
CGFloat toolbarHeight = [toolbar frame].size.height;
CGRect mainViewBounds = self.view.bounds;
[toolbar setFrame:CGRectMake(0,0,320,40)];
[self.view addSubview:toolbar];

Tuesday, November 29, 2011

Automatic Reference Counting (ARC)

Automatic Reference Counting (ARC) for Objective-C makes memory management the job of the compiler. By enabling ARC with the new Apple LLVM compiler, you will never need to type retain or release again, dramatically simplifying the development process, while reducing crashes and memory leaks. The compiler has a complete understanding of your objects, and releases each object the instant it is no longer used, so apps run as fast as ever, with predictable, smooth performance.

Thursday, October 13, 2011

What Have You Tried?

If you’re a developer and you’re about to ask another developer a technical question (on a forum, via email, on a chat channel, or in person), you’d better be ready to answer the question “What have you tried?”
This of course isn’t specific to software developers, but that’s my field and it’s thus the area in which I’m most familiar with the issue which motivated me to write this. I’m (sadly) quite sure that it applies to your own industry too, whatever that might be.

http://mattgemmell.com/2008/12/08/what-have-you-tried/ 

Stop Activity Indicator in Status Bar ?


Implement the UIWebViewDelegate in your class file that holds the UIWebView,
and insert the following two methods:
- (void)webViewDidStartLoad:(UIWebView *)webView

- (void)webViewDidFinishLoad:(UIWebView *)webView
 In the start method, place your:
 [UIApplication sharedApplication].networkActivityIndicator
Visible = YES;
 ... and in the finish, place:
 [UIApplication sharedApplication].networkActivityIndicator
Visible = NO;

Hope this helps!

Create a list in SwiftUI with sticky section headers

 Sample Code import SwiftUI struct ContentView : View {     @State var isCustomViewControllerDisplayed = false     @State private va...