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
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string | |
{ | |
NSCharacterSet *nonNumberSet = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789."] invertedSet]; | |
// allow backspace | |
if (range.length > 0 && [string length] == 0) | |
{ | |
return YES; | |
} | |
// Comment out to allow decimal at the beginning | |
// do not allow . at the beggining |
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
// Multidimentional arrays | |
int n = 2, m = 4; | |
int matrix[n][m]; | |
int i = 0; | |
for (unsigned x = 0; x < n; x++) | |
{ | |
for (unsigned y = 0; y < m; y++) | |
{ |
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> | |
int main (int argc, const char *argv[]) | |
{ | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
NSMutableArray *collectionArray = [[NSMutableArray alloc] init]; | |
NSArray *numArray = [[NSArray alloc] init]; | |
NSArray *strArray = [[NSArray alloc] init]; | |
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 <UIKit/UIKit.h> | |
#define kSelectedTabDefaultsKey @"Selected Tab" | |
enum { | |
kByName, | |
kByObject, | |
}; | |
@interface ToDoListViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UITabBarDelegate, UIAlertViewDelegate, NSFetchedResultsControllerDelegate> | |
{ |
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 | |
{ | |
[segmentControl addTarget: self action: @selector(segmentChanged:) forControlEvents: UIControlEventValueChanged]; | |
[super viewDidLoad]; | |
} | |
-(IBAction) segmentChanged: (id) sender | |
{ | |
NSInteger segmentChoice = [segmentControl selectedSegmentIndex]; |
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 "UsingViewsViewController.h" | |
@implementation UsingViewsViewController | |
@synthesize pageControl; | |
@synthesize image_1, image_2; | |
/* |
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
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
MyViewController *viewController = [[MyViewController alloc] initWithNibName: @"MyViewController" bundle: [NSBundle mainBundle]]; | |
self.myViewController = viewController; | |
[window addSubview: [myViewController view]]; | |
[window makeKeyAndVisible]; | |
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
NSArray *colorList = [NSArray arrayWithObject: [NSDictionary dictionaryWithObjectsAndKeys: | |
@"BrownColor", @"titleValue", [UIColor brownColor], @"colorValue", nil], | |
[NSDictionary dictionaryWithObjectsAndKeys: @"orangeColor", @"titleValue", [UIColor orangeColor], @"colorValue", nil], | |
[NSDictionary dictionaryWithObjectsAndKeys: @"purpleColor", @"titleValue", [UIColor purpleColor], @"colorValue", nil]; | |
[NSDictionary dictionaryWithObjectsAndKeys: @"redColor", @"titleValue", [UIColor redColor], @"colorValue", nil], nil]; | |
[colorList retain]; | |
// Playing with some new code |
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 <UIKit/UIKit.h> | |
#import <AudioToolbox/AudioToolbox.h> | |
// The delegates are something that we shall use in order to get more usefulness out of the | |
// Application -It is given, and free funcitonality. | |
@interface AttentionViewController : UIViewController <UIAlertViewDelegate, UIActionSheetDelegate> | |
{ | |
IBOutlet UILabel *statusText; | |
} |
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 "FlowerColorTableViewController.h" | |
#define sectionCount 2 | |
#define redSection 0 | |
#define blueSection 1 | |
@implementation FlowerColorTableViewController | |
#pragma mark - |
NewerOlder