Skip to content

Instantly share code, notes, and snippets.

@keicoder
keicoder / Core Data Properties and Instance Methods.m
Created March 9, 2014 05:22
objective-c : Core Data Properties and Instance Methods
//Core Data Properties and Instance Methods
//AppDelegate.m
#pragma mark - Properties
- (NSManagedObjectContext *)managedObjectContext
{
if (_managedObjectContext != nil)
{
@keicoder
keicoder / generate random number with array.m
Created March 9, 2014 05:04
objective-c : generate random number with array
//generate random number with array
- (void)awakeFromInsert //invoked automatically by the Core Data framework when the receiver is first inserted into a managed object context.
{
[super awakeFromInsert];
NSString *quotesFilePath = [[NSBundle mainBundle]
pathForResource:@"QuotesList"
ofType:@"plist"];
@keicoder
keicoder / Source Control in Xcode 5.m
Created March 7, 2014 10:51
objective-c : Source Control in Xcode 5
//Source Control in Xcode 5
//1. Git settings
//configure git with your name and email address so that your changes are tracked properly.
//open a Terminal window and enter the following commands:
//below commands will save your name and email to your local ~/.gitconfig file
git config --global user.name "YOUR NAME HERE"
@keicoder
keicoder / snippet.m
Created March 7, 2014 02:40
objective-c : making custom SearchBar
//making custom SearchBar
//SSAppDelegate.h
@interface SSAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
@keicoder
keicoder / Intermediate Text Kit (master-detail book app for ipad).m
Created March 6, 2014 01:13
objective-c : Intermediate Text Kit (master-detail book app for ipad)
//Intermediate Text Kit (master-detail book app for ipad)
//1. basic UI
//AppDelete.h
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@keicoder
keicoder / snippet.m
Last active August 29, 2015 13:57
objective-c : modify textView size when keyboard appears
//modify textView size when keyboard appears and disappears
//Add the following instance variable to NoteEditorViewController.m
@implementation NoteEditorViewController
{
//...
CGRect _textViewFrame; //used to store the current text view frame
}
@keicoder
keicoder / snippet.m
Created March 4, 2014 02:40
objective-c : Textkit and TableView with note (ios 7)
//Textkit and TableView with note (ios 7)
//1. start with basic dummy data
//AppDelegate.h
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property NSMutableArray* notes;
@keicoder
keicoder / automatically extract first line of string, based on the first few words.m
Created March 4, 2014 02:14
objective-c : automatically extract first line of string, based on the first few words
// automatically extract first line of string, based on the first few words
// for example, can using this for title of note
//.h
//
@property NSString* contents;
@property (readonly) NSString* title;
//.m
@keicoder
keicoder / snippet.m
Created March 3, 2014 12:44
objective-c : adjust UITextView size and scrolling position
//adjust UITextView size and scrolling position
- (void)viewDidLoad
{
if (debug==1) {NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));}
[super viewDidLoad];
[self registerForKeyboardNotifications];
}
@keicoder
keicoder / snippet.m
Created March 3, 2014 09:47
objective-c : set the frame of the view
//set the frame of the view
/*
_theImageView.frame = CGRectMake(x, y, width, height);
Frame is in reference to its parent view,
Bounds are in reference to the view itself
*/
//ex