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
// This should be the viewcontroller that the keyboard commmunicates with. | |
@interface KeyboardDismissalViewController : UIViewController | |
@property (strong, nonatomic) IBOutlet UITextField *theTextFieldThatOpensTheKeyboardInTheFirstPlace; | |
- (IBAction)textFieldDoneEditing:(id)sender; | |
- (IBAction)backgroundTap:(id)sender; | |
@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
// Sometimes you just need a random colour! I think I got this from apress's Beginning iOS Development book, kudos to them. | |
CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0 | |
CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white | |
CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black | |
UIColor *color = [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; |
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
@interface ADKAppDelegate : UIResponder <UIApplicationDelegate> | |
@property (strong, nonatomic) NSMutableDictionary *storageDict; | |
-(NSString *)filePath; | |
@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
Storyboard configuration: | |
1. Make a cell. | |
2. Give it a custom class of YourCell | |
3. Drag a label onto the cell, give the label a tag of 100. Configure and arrange as necessary. | |
4. Drag a text field onto the cell, give the textField a tag of 101. Configure and arrange as necessary. |
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
# 1. Use Celery: | |
# http://celery.readthedocs.org/en/latest/tutorials/debugging.html | |
from celery import task | |
from celery.contrib import rdb | |
@task() | |
def add(x, y): | |
result = x + y | |
rdb.set_trace() # <- set breakpoint |
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
from PIL import Image | |
img = Image.open("imagefilename.png") | |
print img.size | |
# 512, 512 | |
print img.format | |
# PNG | |
print img.mode | |
# RGB |
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
- (void)viewDidLoad | |
{ | |
CGRect rect = CGRectMake(0, 0, self.view.frame.size.width, 20); | |
UIView *statusBarBg = [[UIView alloc] initWithFrame:rect]; | |
[self.view addSubview:statusBarBg]; | |
statusBarBg.backgroundColor = [UIColor purpleColor]; | |
} | |
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 BouncyTransition : NSObject <UIViewControllerAnimatedTransitioning> | |
@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
@interface RootVC : UIViewController <UIViewControllerTransitioningDelegate> |
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
@interface InteractiveTransition.h : NSObject <UIViewControllerAnimatedTransitioning> | |
@end |
OlderNewer