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
//launch with Xib for iPhone and iPad | |
//ex 1. | |
//DLAppDelegate.h | |
@class DLViewController; | |
@interface DLAppDelegate : UIResponder <UIApplicationDelegate> |
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
//Note with Core Data (SwiftNote5) | |
//1. save, delete, edit note with coredata (AddNoteView, TableView) | |
//AppDelegate.h | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) UIWindow *window; |
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
//two ways of making UITableView Cell | |
//ex | |
//1. much simpler | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *CellIdentifier = @"Cell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
// Configure the cell... |
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
//Basic delegate pattern | |
//AppDelegate.h | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) UIWindow *window; | |
@end |
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
//graphics and animations on iOS | |
//drawRect vs. setNeedsDisplay | |
//When a view is refreshed, the drawRect function for that view is called. This function draws content to the view every time it is called. Because drawRect is called often, it should be a very lightweight. Don’t allocate memory in drawRect, and never call drawRect directly from your code. (We will discuss overriding drawRect further in Chapter 8, Creating Custom UIViews and UIViewControllers.) | |
//So, if you can’t call drawRect from your code, how do you refresh a view? The answer is to call the function setNeedsDisplay. Because resources are scarce on mobile devices, iOS attempts to optimize resource intensive processes whenever possible. Drawing content to the screen can require a lot of resources. Instead of manually calling drawRect to refresh a view, set the view as setNeedsDisplay. When a view has the setNeedsDisplay flag set, iOS automatically refreshes the view when it is most efficient. The time delay between drawRect and setNeedsDisp |
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
//prepareForSegue method | |
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
if ([[segue identifier] isEqualToString:@"addCourse"]) { | |
//ex | |
//1. to typical view controller with modal segue | |
//AddCourseViewController *acvc = (AddCourseViewController *)[segue destinationViewController]; |
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
//Core Data Essential (CDCourses) | |
//Course.h | |
#import <CoreData/CoreData.h> | |
@interface Course : NSManagedObject | |
@property (nonatomic, retain) NSString * title; |
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
//making basic UICollectionView | |
//UICollectionView 주요 메소드 (UITableView와 비교) | |
//UICollectionView vs UITableView | |
//Item(Cell) 갯수(필수) | |
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
//Item(Cell) 꾸미기(필수) |
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
//get image in bundle on certain condition (특정 조건에 따라 번들에 포함된 이미지 가져오기) | |
//BJDCard.h | |
#import <Foundation/Foundation.h> | |
typedef enum : int | |
{ | |
BJCardSuitClub = 0, |
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
//Custom UITextView with JavaScript Core | |
//1. Setting up the console | |
//ConsoleTextView.h | |
@interface ConsoleTextView : UITextView | |
- (void)setText:(NSString *)text concatenate:(BOOL)concatenate; |