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
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON ) |
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
//H | |
@interface UITextField(UITextFieldCategory) { | |
} | |
- (CGRect)editingRectForBounds:(CGRect)bounds; | |
- (CGRect)textRectForBounds:(CGRect)bounds; | |
@end | |
//M |
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
- (void)textFieldDidBeginEditing:(UITextField *)textField | |
{ | |
UITextPosition *beginning = [textField beginningOfDocument]; | |
[textField setSelectedTextRange:[textField textRangeFromPosition:beginning | |
toPosition:beginning]]; | |
} |
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
XCTFail (format…) | |
XCTAssertNil (a1, format…) | |
XCTAssertNotNil (a1, format…) | |
XCTAssert (a1, format…) | |
XCTAssertTrue (a1, format…) | |
XCTAssertFalse (a1, format…) | |
XCTAssertEqualObjects (a1, a2, format…) | |
XCTAssertEquals (a1, a2, format…) | |
XCTAssertEqualsWithAccuracy (a1, a2, accuracy, format…) | |
XCTAssertThrows (expression, format…) |
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
typedef enum { | |
UIKeyboardTypeDefault, // Default type for the current input method. | |
UIKeyboardTypeASCIICapable, // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active | |
UIKeyboardTypeNumbersAndPunctuation, // Numbers and assorted punctuation. | |
UIKeyboardTypeURL, // A type optimized for URL entry (shows . / .com prominently). | |
UIKeyboardTypeNumberPad, // A number pad (0-9). Suitable for PIN entry. | |
UIKeyboardTypePhonePad, // A phone pad (1-9, *, 0, #, with letters under the numbers). | |
UIKeyboardTypeNamePhonePad, // A type optimized for entering a person's name or phone number. | |
UIKeyboardTypeEmailAddress, // A type optimized for multiple email address entry (shows space @ . prominently). |
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
static NSString *cellIdentifier = @"SomeCell"; | |
QRScanCell *cell = [self.tableView dequeueReusableCellWithIdentifier:cellIdentifier]; | |
if (!cell) | |
{ | |
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SomeCellNib" | |
owner:self | |
options:nil]; | |
cell = [nib lastObject]; | |
} |
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
//Remove seperator insets on iOS7 | |
[self.tableView setSeparatorInset:UIEdgeInsetsZero]; | |
//Set a custom cell seperator | |
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
... |
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
//Setup | |
NSTimer *aTimer = [NSTimer scheduledTimerWithTimeInterval:0.1f | |
target:self | |
selector:@selector(someSelector) | |
userInfo:nil | |
repeats:YES]; | |
//Tear down | |
[aTimer invalidate]; | |
aTimer = nil; |
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
-(UIView*)paddingViewWithImage:(UIImageView*)imageView andPadding:(float)padding | |
{ | |
float height = CGRectGetHeight(imageView.frame); | |
float width = CGRectGetWidth(imageView.frame) + padding; | |
UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, height)]; | |
[paddingView addSubview:imageView]; | |
return paddingView; |
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
//http://www.tutorialspoint.com/cprogramming/c_preprocessors.htm | |
#define Substitutes a preprocessor macro | |
#include Inserts a particular header from another file | |
#undef Undefines a preprocessor macro | |
#ifdef Returns true if this macro is defined | |
#ifndef Returns true if this macro is not defined | |
#if Tests if a compile time condition is true | |
#else The alternative for #if | |
#elif #else an #if in one statement |