Categories
Iphone Developer Technological

AddressBook UI

Have you ever tried to get data fields from the address book and ran into the wonderful world of ABPerson reference only to find it reads like the blueprints to a space rocket?

Here is the straight out code on how to do it:

//Commented out code fails because the values are NOT STRINGS, but rather NSCFType)
//NSString *fone = (__bridge NSString*)ABRecordCopyValue(person, kABPersonPhoneProperty);
//self.telLabel.text = fone;
//This on the other hand, does work
ABMutableMultiValueRef phoneMulti = ABRecordCopyValue(person, kABPersonPhoneProperty);
CFStringRef fone = ABMultiValueCopyValueAtIndex(phoneMulti, 0);
NSString *foneObject = (__bridge NSString*)fone;
NSLog(@”phone is %@”,foneObject);
self.telLabel.text = foneObject;
CFRelease(fone);

//Haven’t tried with URL
//NSString *url = (__bridge NSString*)ABRecordCopyValue(person, kABPersonURLProperty);
//self.urlLabel.text = [NSString stringWithFormat:url];

//SocialProfiles are a bit different
//This didn’t seem to work
//CFStringRef social = ABMultiValueCopyValueAtIndex(socialMulti, 0);
//NSString *socialObject = (__bridge NSString*)social;
//NSLog(@”social is %@”,socialObject);
//self.twitterName.text = socialObject;
//CFRelease(social);

//So i tried this but I can’t seem to get the if statement to work
ABMutableMultiValueRef socialMulti = ABRecordCopyValue(person, kABPersonSocialProfileProperty);
NSMutableDictionary *mySocialDict = [NSMutableDictionary dictionaryWithCapacity:ABMultiValueGetCount(socialMulti)];
NSLog(@”entering social dict of count %ld”, ABMultiValueGetCount(socialMulti));
for (CFIndex i = 0; i < ABMultiValueGetCount(socialMulti); i++) {
CFStringRef socialLabel = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(socialMulti, i));
CFStringRef social = ABMultiValueCopyValueAtIndex(socialMulti, i);
if ([(__bridge NSString*)socialLabel isEqualToString:@"twitter"]) {
NSLog(@"we got a twitter");
}
[mySocialDict setObject:(__bridge NSString*)social forKey:(__bridge NSString*)socialLabel];
NSLog(@"social is %@",social);

CFRelease(social);
CFRelease(socialLabel);
}

Categories
Iphone Developer Technological

Santiapps.com: Digital Graphic Design for newbies (noobs)

Wanted to share this tutorial for graphic design noobs that are interested in creating their own artwork for iOS games. You may indeed have some graphic design skills and some much better programming skills but turning your paper art into digital usable art is a whole new ballgame.

Visit this tutorial in spanish, since this is a spanish blog:

Diseno Grafico para Juegos Digitales (Principiantes)

Categories
Iphone Developer

Storyboarding is for everyone in Xcode 4

I just ran across storyboards in iOS5 and I had to link back to this article with the best storyboard tutorials:

Storyboard Tutorials!