How To

How to use iPhone contacts in your own application

In this how to series, I have come up with yet another code snippet, which allows you to use iPhone’s contact data into your own application. The code is: -(void)retrieveContactList { ABAddressBookRef myAddressBook = ABAddressBookCreate(); NSArray *allPeople = (NSArray *)ABAddressBookCopyArrayOfAllPeople(myAddressBook); contactList = [[NSMutableArray alloc]initWithCapacity:[allPeople count]]; for (id record in allPeople)…

iPhone – How to find height of a label for dynamic string in it.

Here is a small but very useful function, which gives height of a label for which dynamic string is to be set: -(NSInteger) findHeightOfLabelString:(NSString *)textString{ UIFont *font = [UIFont systemFontOfSize:17]; CGSize size = CGSizeMake(175.0f, MAXFLOAT); CGSize labelSize=[textString sizeWithFont:font constrainedToSize:size lineBreakMode:UILineBreakModeWordWrap]; return labelSize.height;}