This file contains 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
//테이블 뷰 레이블 (not embeded lable) tag 설정 | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ChecklistItem"]; | |
//tag 값으로 지정하기 | |
UILabel *label = (UILabel *)[cell viewWithTag:1000]; | |
if (indexPath.row == 0) { |
This file contains 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
#pragma mark - 테이블 뷰 delegate 메소드 (사용자가 테이블 셀을 선택할 수 없도록 하기) | |
//static 셀이므로 셀을 탭할 수 없도록 함 | |
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
if (debug==1) {NSLog(@"Running %@ '%@'", self.class, NSStringFromSelector(_cmd));} | |
return nil; //사용자가 테이블 셀을 선택할 수 없도록 하기 | |
} |
This file contains 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
//steps for setting up the delegate pattern between two objects | |
//steps for setting up the delegate pattern between two objects, | |
//where object A is the delegate for object B and object B will send out the messages: | |
//1. Define a delegate @protocol for object B. | |
//2. Give object B a property for that delegate protocol. | |
//3. Make object B send messages to its delegate when something interesting happens, | |
//such as the user pressing the Cancel or Done buttons, or when it needs a piece of information. | |
//4. Make object A conform to the delegate protocol. | |
//It should put the name of the protocol in its @interface line and implement the methods from the protocol. |
This file contains 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
//UIKit Dynamics 기초 (view, barrier, gravity, collision, elasticity, attachmentBehavior) | |
//ViewController.m | |
//.m | |
#import "ViewController.h" | |
//UICollisionBehaviorDelegate : receive notifications when items collide | |
@interface ViewController () <UICollisionBehaviorDelegate> { | |
//ivars | |
UIDynamicAnimator* _animator; |
This file contains 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
//UIView animateWithDuration 블록 코드 | |
[UIView animateWithDuration:.2 animations:^{ | |
//code here | |
}]; |
This file contains 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
//snapBehavior example code | |
@implementation DynamicSandwichViewController | |
{ | |
NSMutableArray* _views; | |
UISnapBehavior* _snap; | |
BOOL _viewDocked; | |
} | |
This file contains 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
//AppDelegate basic code with debug | |
#import "AppDelegate.h" | |
@implementation AppDelegate | |
#define debug 1 | |
#pragma mark - didFinishLaunchingWithOptions |
This file contains 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
//make basic table view with custom background and jason data | |
//AppDelegate.h | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) UIWindow *window; | |
@property (readonly, nonatomic) NSArray* sandwiches; | |
@end |
This file contains 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
//make basic table view with custom background and jason data v.2 | |
//make SandwichView (Detail View) with data | |
//CollectionViewLabelCell.h | |
@interface CollectionViewLabelCell : UICollectionViewCell | |
@property (nonatomic, readonly) UILabel* title; | |
@end |
This file contains 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
//make basic table view with custom background and jason data v.3 | |
//iterate over the recipes and use the addRecipeAtOffset: forSandwich: method | |
//to add each recipe to the view | |
//DynamicSandwichViewController.h | |
@interface DynamicSandwichViewController : UIViewController | |
@end | |