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
#import <Foundation/Foundation.h> | |
@interface JNWThrottledBlock : NSObject | |
// Runs the block after the buffer time _only_ if another call with the same identifier is not received | |
// within the buffer time. If a new call is received within that time period the buffer will be reset. | |
// The block will be run on the main queue. | |
// | |
// Identifier and block must not be nil. | |
+ (void)runBlock:(void (^)())block withIdentifier:(NSString *)identifier throttle:(CFTimeInterval)bufferTime; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>__IAWRITER_DOCUMENT_TITLE__</title> | |
<meta name="author" content="__IAWRITER_USER_NAME__"> | |
<meta name="generator" content="iA Writer for Mac __IAWRITER_BUNDLE_VERSION__"> | |
<meta name="description" content=""> | |
<meta name="keywords" content=""> |
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
// | |
// WGenServer.h | |
// WgenTestCommon | |
// | |
// Created by Sebastian Windal on 10/24/12. | |
// Copyright (c) 2012 Sebastian Windal. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import "WGenPeer.h" |
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
// | |
// WGenServer.m | |
// WgenTestCommon | |
// | |
// Created by Sebastian Windal on 10/24/12. | |
// Copyright (c) 2012 Sebastian Windal. All rights reserved. | |
// | |
#import "WGenServer.h" | |
#import "GCDAsyncSocket.h" |
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
// what do you get? | |
// compile error? | |
// compile warning? | |
// runtime crash? | |
// value X displayed on console. | |
// 1. | |
NSString *str1 = @"hello"; | |
NSLog(@"%d", [str1 length]); |
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
- (IBAction)myButtonAction:(id)sender { | |
UIButton *myButton = (UIButton *) sender; | |
if (myButton.tag == 1) { | |
// do X | |
} | |
else if (myButton.tag == 2) { | |
// do Y | |
} | |
else if (myButton.tag == 3) { |
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
@implementation MyView2 | |
- (id)initWithFrame:(CGRect)frame | |
{ | |
self = [super initWithFrame:frame]; | |
if (self) { | |
// Initialization code | |
} | |
return self; | |
} |
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
@implementation ViewController3 | |
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | |
{ | |
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | |
if (self) { | |
// Custom initialization | |
} | |
return self; | |
} |
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
|I Want to:|init(s)|lazy loading|viewDidLoad|viewWillAppear| | |
|----------|-------|------------|-----------|--------------| | |
|Initialize obj-c objects (array, dictionaries, etc...)| X | | | | | |
|Initialize C stuff (C buffer, etc...)|X||||| | |
|Setup UI stuff in code that is not layout related (UILabel fonts, texts, etc...)|||X|| | |
|Adjust layout of elements in code, reposition things around||||X| | |
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
/// table view | |
-(void) tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; | |
cell.contentView.alpha = 0.7; | |
[UIView animateWithDuration:0.15 | |
delay:0.0 | |
options:UIViewAnimationOptionCurveEaseInOut |