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)viewDidLoad | |
| { | |
| [super viewDidLoad]; | |
| // Do any additional setup after loading the view, typically from a nib. | |
| for (UIView *view in self.view.subviews) | |
| { | |
| // this is how you programmatically add a gustom gesture recognizer | |
| UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]; | |
| recognizer.delegate=self; |
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
| CGRect passwordTextFieldFrame = CGRectMake(20.0f, 100.0f, 280.0f, 31.0f); | |
| UITextField *passwordTextField = [[UITextField alloc] initWithFrame:passwordTextFieldFrame]; | |
| passwordTextField.placeholder = @"Password"; | |
| passwordTextField.backgroundColor = [UIColor whiteColor]; | |
| passwordTextField.textColor = [UIColor blackColor]; | |
| passwordTextField.font = [UIFont systemFontOfSize:14.0f]; | |
| passwordTextField.borderStyle = UITextBorderStyleRoundedRect; | |
| passwordTextField.clearButtonMode = UITextFieldViewModeWhileEditing; | |
| passwordTextField.returnKeyType = UIReturnKeyDone; | |
| passwordTextField.textAlignment = UITextAlignmentLeft; |
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
| // Manual Reference counting (MRR) - just like Maximum Rock'n'Roll! | |
| /* | |
| With MRR you have to ensure that every object you allocate | |
| Moves from the start to the finish of its life cycle without being prematurely | |
| released and to guarantee that it does get finally released when it is time to do so | |
| Complicating matters is objective-C's MRR autorelease pool. | |
| If some objects are autoreleased and others must be released manaually how do you best control your objects? |
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
| // thank you matt neuberg!!! | |
| -(CGRect)textRectForBounds:(CGRect)bounds | |
| limitedToNumberOfLines:(NSInteger)numberOfLines { | |
| CGSize sz = [self.text sizeWithFont:self.font | |
| constrainedToSize:CGSizeMake(self.bounds.size.width, 10000) | |
| lineBreakMode:self.lineBreakMode]; | |
| return (CGRect) {bounds.origin, CGSizeMake(self.bounds.size.width, sz.height)]; | |
| } |
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
| #pragma mark - | |
| #pragma mark - UITextFieldDelegate | |
| -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string | |
| { | |
| // let's check if the string is range is a number | |
| NSRange characterRange = [string rangeOfCharacterFromSet:[NSCharacterSet letterCharacterSet]]; | |
| // if we've detected a character in our string, we're not going to insert that letter character in our text field | |
| if(characterRange.location != NSNotFound) { | |
| return NO; |
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
| // | |
| // MasterViewController.m | |
| // CoffeeShop | |
| // | |
| // | |
| // Copyright (c) 2013 uihelpers. All rights reserved. | |
| // | |
| #import "MasterViewController.h" | |
| #import <RestKit/RestKit.h> | |
| #import "Venue.h" |
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
| - (BOOL) isGyroscopeAvailable | |
| { | |
| #ifdef __IPHONE_4_0 | |
| CMMotionManager *motionManager = [[CMMotionManager alloc] init]; | |
| BOOL gyroscopeAvailable = motionManager.gyroAvailable; | |
| [motionManager release]; | |
| return gyroscopeAvailable; | |
| #else | |
| return NO; | |
| #endif |
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
| // | |
| // FirstViewController.m | |
| // iOS_AR_Ch2_HardwareComparison | |
| // | |
| // Created by Kyle Roche on 6/13/11. | |
| // Copyright 2011 Isidorey. All rights reserved. | |
| // | |
| #import "FirstViewController.h" |
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
| /* | |
| Structs are the most flexible C data type | |
| can combine different types of data, access that data using named fields | |
| makes heavy use of C Structures -- many Core Frameworks in ObjC are written in pure C | |
| */ | |
| struct CGPoint { | |
| CGFloat x; | |
| CGFloat y; | |
| }; |
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
| // Enumerations provide a concise, elegant method for defining a discrete set of values | |
| typedef enum { | |
| SUNDAY, | |
| MONDAY, | |
| TUESDAY, | |
| WEDNESDAY, | |
| THURSDAY, | |
| FRIDAY, | |
| SATURDAY |