This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Keep Track of Your Files’ SCM Status | |
You can keep track of your files’ SCM status in the project navigator. SCM status is shown as a badge next to the file name as follows: | |
Badge SCM status | |
M Locally modified | |
U Updated in repository | |
A Locally added |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To initialize a view controller with a nib file you use initWithNibName. | |
UIViewController *viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]; | |
//Using Storyboard instead of nib files, use the UIStoryboard class | |
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MyStoryboard" bundle:nil]; | |
UIViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Go to the directory containing your project. | |
cd <directory of your Xcode project> | |
//If you already have a local git project, skip the steps below | |
git init . | |
git add . | |
git commit -s <type in a commit message> | |
//Push into your repository. --Push an existing repository from the command line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Useful iOS Project structure | |
A simple folder structure: | |
AppDelegate | |
Controllers | |
Models | |
Helpers | |
Folder Structure for a complex app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
int r = arc4random() % 74; | |
arc4random_uniform(74) | |
//Use the arc4random_uniform(upper_bound) function to generate a random number within a range. | |
//The following will generate a number between 0 and 73 inclusive. | |
arc4random_uniform(74) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This will check a UITextField for a proper email and phone number of 10 digits or less. | |
//Add this method to the textFields delegate then check if the characters it is about to change should be added or not. | |
//Return YES or NO depending on the text field, how many characters are currently in it, and what characters it wants to add: | |
#define ALPHA @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | |
#define NUMERIC @"1234567890" | |
#define ALPHA_NUMERIC ALPHA NUMERIC | |
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { | |
NSCharacterSet *unacceptedInput = nil; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDateFormatter *formatter; | |
NSString *dateString; | |
formatter = [[NSDateFormatter alloc] init]; | |
[formatter setDateFormat:@"dd-MM-yyyy HH:mm"]; | |
dateString = [formatter stringFromDate:[NSDate date]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To avoid always entering your login credentials and generating SSH keys, you'll want to install the credential helper so your passwords are cached. On OS X, you'll need to handle this through the Terminal. To start, use this command to download the credential helper: | |
//Get the helper | |
curl -s -O \ | |
http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain | |
//change permissions | |
chmod u+x git-credential-osxkeychain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Master-Detail App Template | |
===================== | |
A Master-Detail App Template from Xcode | |
Overview | |
-------- | |
- version: 0.1.0 | |
Description |