Using NSUserDefaults is great when you want to save small amounts of application data such as log in, last settings, etc An Example Saving NSUserDefaults *NonVolatile = [NSUserDefaults standardUserDefaults]; [NonVolatile setObject:@”TextToSave” forKey:@”keyToLookupString”]; //Saving an NSString [NonVolatile setInteger:42 forKey:@”integerKey”]; //Saving an NSInteger [NonVolatile setBool:YES forKey:@”boolKey”]; //Saving a BOOL [NonVolatile setDouble:3.1415 forKey:@”doubleKey”]; //saving a Double [NonVolatile setFloat:1.2345678 forKey:@”floatKey”]; […]
All posts by
Creating Storyboards
Defining Which Scene Is The First To Be Shown Select the scene and in the Attributes Inspector the "Is Initial View Controller" checkbox. An incoming arrow will point to that scene to confirm its the first. Adding A Scene Drag a "View Controller" object from the Object library panel onto the canvas. Creating the […]
Open Another App
Open Another App NSURL *appURL = [NSURL URLWithString:@”someappname://”]; if ([[UIApplication sharedApplication] canOpenURL:appURL]) { [[UIApplication sharedApplication] openURL:appURL]; } else { NSURL *appStoreURL = [NSURL URLWithString:@”http://itunes.apple.com/gb/app/someappname/id123456789?mt=8#”]; [[UIApplication sharedApplication] openURL:appStoreURL]; }
Download File
Get String From Text File – (NSString *)GetTextFile { NSString *urlString = @"http://mydomain.com/my_file.txt"; NSURL *url = [NSURL URLWithString:urlString]; return [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding error:nil]; } The above works great, but if the iOS device has a WiFi connection but no internet connectivity or if the server is not responding it will lock up indefinately. Use […]
.Storyboards General
Storyboards add a third way to create iOS applications: Write everything in code Use Interface Builder to create main windows Use storyboards With Storyboards the UI is consolidated into a single file with visuals for how each view is arranged together. So, all of the UI work is done in the one place with Interface […]
Screen Size & Screen Element Sizes
Screen Resolutions iPhone 3, 3G 320x480px iPhone 4, 4S 640x960px iPhone 5, 5C, 5S 640 x 1136 iPhone 6 750 x 1334 iPhone 6 Plus 1242 x 2208 (seen by apps) which is downsampled to an actual screen output resolution of 1080 x 1920 (explanations here and here) iPad1, iPad2, iPad Mini original 768x1024px (20 pixels […]
Homescreen Icons For Websites
The iPhone 4 / iPad 3 and above need a 114px x 114px icon. You can create separate resolution icons for each device type, but creating a single 114x114px icon is the easy option and allows it to be scaled for other devices. Save you icon in the root directory of the web site named as: apple-touch-icon-precomposed.png – […]
Default (Launch) Image
The default image is the image that loads while the application starts up. Launch images for all devices must include the status bar region. Create launch images in the following sizes: If the status bar is shown 20 pixels will be covered from the relevant axis (40 pixels for the retina screen versions). The […]
Screenshots for iTunes Connect
iPhone 5 and iPod touch (5th generation) The screenshot dimensions are: 640 x 1136 (portrait) 640 x 1096 (portrait) 1136 x 640 (landscape) 1136 x 600 (landscape)
Detecting Disclosure Button Press
When setting up the cell cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; CGRect frame = CGRectMake(0.0, 0.0, 40, 40); //Image size button.frame = frame; if ([AppMain sharedAppMain].CurrentView == CURRENT_VIEW_PLAYLISTS) { forState:UIControlStateNormal]; } else if (DisplayGreyedOut) { forState:UIControlStateNormal]; } else { forState:UIControlStateNormal]; } ; cell.accessoryView = button; return cell; Button Press //********************************************** //********************************************** //********** ACCESSORY […]