iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

When to use dequeueReusableCellWithIdentifier vs dequeueReusableCellWithIdentifier : forIndexPath

There are two overloads for dequeueReusableCellWithIdentifier and I’m trying to determine when should I use one vs the other? The apple docs regarding the forIndexPath function states, “This method uses the index path to perform additional configuration based on the cell’s position in the table view.” I’m not sure how to interpret that though?

Xcode intellisense meaning of letters in colored boxes like f,T,C,M,P,C,K,# etc

Recently, I have started using Xcode 4 for developing iOS apps. In Xcode intellisense‘s autocomplete box, there are some letters in colored boxes before every suggestion. I know that they represent the property of the word we are typing like f,T,C,M,P,C,K,# etc. Is there some kind of glossary available to find their quick meanings? Meanings […]

App crashed in iOS 6 when user changes Contacts access permissions

I have an app that uses the Address Book. When running in iOS 6 it runs this code when the user does something that requires Address Book access. if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) { ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL); ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) { if (granted) { showContactChooser(); } }); CFRelease(addressBookRef); } else if (ABAddressBookGetAuthorizationStatus() […]

How do I correctly detect orientation change using javascript and Phonegap in IOS?

I found this orientation test code below looking for JQTouch reference material. This works correctly in the IOS simulator in mobile safari but doesn’t handle correctly in Phonegap. My project is running into the same issue that is killing this test page. Is there a way to sense the orientation change using javascript in Phonegap? […]

iCloud basics and code sample

As a beginner, I’m struggling with iCloud. There are some samples, but they are usually quite detailed (on the developer forum there is one for iCloud and CoreData which is massive). The apple docs are OK, but I still can’t see the big picture. So please bear with me, some of these questions are quite […]

iOS 8 enabled device not receiving PUSH notifications after code update

I recently upgraded one of my test iphones to iOS 8 and then upgraded the PUSH registration code as below (using xCode 6) -(BOOL)hasNotificationsEnabled { NSString *iOSversion = [[UIDevice currentDevice] systemVersion]; NSString *prefix = [[iOSversion componentsSeparatedByString:@”.”] firstObject]; float versionVal = [prefix floatValue]; if (versionVal >= 8) { NSLog(@”%@”, [[UIApplication sharedApplication] currentUserNotificationSettings]); //The output of this […]

How do I convert a Swift Array to a String?

I know how to programmatically do it, but I’m sure there’s a built-in way… Every language I’ve used has some sort of default textual representation for a collection of objects that it will spit out when you try to concatenate the Array with a string, or pass it to a print() function, etc. Does Apple’s […]

How to use UIScrollView in Storyboard

I have a scroll view with content that is 1000px tall and would like to be able to lay it out for easy design on the storyboard. I know it can be done programmatically but I really want to be able to see it visually. Every time I put a scroll view on a view […]

Scheduled NSTimer when app is in background?

How do people deal with a scheduled NSTimer when an app is in the background? Let’s say I update something in my app every hour. updateTimer = [NSTimer scheduledTimerWithTimeInterval:60.0*60.0 target:self selector:@selector(updateStuff) userInfo:nil repeats:YES]; When in the background, this timer obviously doesn’t fire(?). What should happen when the user comes back to the app..? Is the […]

How to group by the elements of an array in Swift

Let’s say that I have this code: class Stat { var statEvents : [StatEvents] = [] } struct StatEvents { var name: String var date: String var hours: Int } var currentStat = Stat() currentStat.statEvents = [ StatEvents(name: “lunch”, date: “01-01-2015”, hours: 1), StatEvents(name: “dinner”, date: “01-01-2015”, hours: 1), StatEvents(name: “dinner”, date: “01-01-2015”, hours: 1), […]