Permalink
Browse files

Adding readme for URL schemes

  • Loading branch information...
1 parent ff081e3 commit 5d3df10d94813daa0a2832f1864bc674170596e8 Erica Sadun committed Oct 5, 2009
Showing with 648 additions and 209 deletions.
  1. +4 −8 C12-GameKit/01-Simple GameKit/main.m
  2. +4 −6 C12-GameKit/02-Monitoring GameKit/main.m
  3. +0 −6 C12-GameKit/06-PictureCatcher AppleTCP/Catcher.h
  4. +18 −24 C12-GameKit/06-PictureCatcher AppleTCP/Catcher.m
  5. +4 −9 C12-GameKit/08-Bonjour Helper/main.m
  6. +4 −8 C12-GameKit/09-GameKit Online Mode/main.m
  7. +1 −2 C13-Networking/04-Recovering IP Information/main.m
  8. +1 −3 C13-Networking/05-Site Reachability/main.m
  9. +1 −3 C13-Networking/06-Synchronous Downloads/main.m
  10. +4 −8 C13-Networking/07-Asynchronous Downloads/main.m
  11. +4 −8 C13-Networking/08-Authentication Challenge/main.m
  12. +0 −2 C13-Networking/09-UNPW Settings Screen/SettingsViewController.h
  13. +8 −10 C13-Networking/09-UNPW Settings Screen/SettingsViewController.m
  14. +0 −2 C13-Networking/09-UNPW Settings Screen/main.m
  15. +0 −2 C13-Networking/10-iTweet/SettingsViewController.h
  16. +8 −10 C13-Networking/10-iTweet/SettingsViewController.m
  17. +7 −11 C13-Networking/10-iTweet/main.m
  18. +0 −2 C13-Networking/11-iTweetPic/SettingsViewController.h
  19. +8 −10 C13-Networking/11-iTweetPic/SettingsViewController.m
  20. +6 −12 C13-Networking/11-iTweetPic/main.m
  21. +0 −2 C13-Networking/12a-MultiApp 1/SettingsViewController.h
  22. +8 −10 C13-Networking/12a-MultiApp 1/SettingsViewController.m
  23. +7 −11 C13-Networking/12a-MultiApp 1/main.m
  24. +0 −2 C13-Networking/12b-MultiApp 2/SettingsViewController.h
  25. +8 −10 C13-Networking/12b-MultiApp 2/SettingsViewController.m
  26. +7 −11 C13-Networking/12b-MultiApp 2/main.m
  27. +1 −0 C13-Networking/13-XML Browser/TreeNode.m
  28. +1 −3 C13-Networking/14-Web Browser/main.m
  29. +7 −9 C13-Networking/15-FTP Helper/main.m
  30. +2 −4 C13-Networking/ZZ-Unique IDs/main.m
  31. +1 −0 C14-Device/README.markdown
  32. +1 −0 C15-Media/07-OffsiteVideo/main.m
  33. BIN C15-Media/07b-Video Loop/Default.png
  34. +239 −0 C15-Media/07b-Video Loop/HelloWorld.xcodeproj/project.pbxproj
  35. +8 −0 C15-Media/07b-Video Loop/HelloWorld_Prefix.pch
  36. +26 −0 C15-Media/07b-Video Loop/Info.plist
  37. +180 −0 C15-Media/07b-Video Loop/TestBedViewController.xib
  38. BIN C15-Media/07b-Video Loop/cover320x416.png
  39. BIN C15-Media/07b-Video Loop/icon.png
  40. +66 −0 C15-Media/07b-Video Loop/main.m
  41. +1 −1 C17-CoreLocation/09-Geocoding/main.m
  42. +3 −0 C21-Grab Bag/README.markdown
@@ -15,18 +15,14 @@ @interface TestBedViewController : UIViewController <GameKitHelperDataDelegate,
IBOutlet UITextView *sendView;
IBOutlet UITextView *receiveView;
}
-@property (retain) UITextView *sendView;
-@property (retain) UITextView *receiveView;
@end
@implementation TestBedViewController
-@synthesize sendView;
-@synthesize receiveView;
- (void)textViewDidChange:(UITextView *)textView
{
if (![GameKitHelper sharedInstance].isConnected) return;
- NSString *text = self.sendView.text;
+ NSString *text = sendView.text;
if (!text || (text.length == 0)) text = @"xyzzyclear";
NSData *textData = [text dataUsingEncoding:NSUTF8StringEncoding];
[GameKitHelper sendData:textData];
@@ -35,12 +31,12 @@ - (void)textViewDidChange:(UITextView *)textView
-(void) receivedData: (NSData *) data
{
NSString *text = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
- self.receiveView.text = [text isEqualToString:@"xyzzyclear"] ? @"" : text;
+ receiveView.text = [text isEqualToString:@"xyzzyclear"] ? @"" : text;
}
- (void) clear
{
- self.sendView.text = @"";
+ sendView.text = @"";
}
- (void) viewDidLoad
@@ -52,7 +48,7 @@ - (void) viewDidLoad
[GameKitHelper sharedInstance].dataDelegate = self;
[GameKitHelper assignViewController:self];
- [self.sendView becomeFirstResponder];
+ [sendView becomeFirstResponder];
}
@end
@@ -15,18 +15,16 @@ @interface TestBedViewController : UIViewController <GameKitHelperDataDelegate,
{
IBOutlet UITextView *textView;
}
-@property (retain) UITextView *textView;
@end
@implementation TestBedViewController
-@synthesize textView;
- (void) listenForStderr: (NSTimer *) timer;
{
- NSString *contents = [NSString stringWithContentsOfFile:STDERR_OUT];
+ NSString *contents = [NSString stringWithContentsOfFile:STDERR_OUT encoding:NSUTF8StringEncoding error:NULL];
contents = [contents stringByReplacingOccurrencesOfString:@"\n" withString:@"\n\n"];
- if ([contents isEqualToString:self.textView.text]) return;
- [self.textView setText:contents];
- self.textView.contentOffset = CGPointMake(0.0f, MAX(self.textView.contentSize.height - self.textView.frame.size.height, 0.0f));
+ if ([contents isEqualToString:textView.text]) return;
+ [textView setText:contents];
+ textView.contentOffset = CGPointMake(0.0f, MAX(textView.contentSize.height - textView.frame.size.height, 0.0f));
}
- (void) viewDidLoad
@@ -16,12 +16,6 @@
BOOL success;
}
-@property (retain) NSImageView *imageView;
-@property (retain) NSTextField *textField;
-@property (retain) NSTextField *statusText;
-@property (retain) NSButton *button;
-@property (retain) NSProgressIndicator *progress;
-@property (retain) NSMenuItem *saveItem;
@property (retain) NSData *imageData;
@property (retain) NSNetServiceBrowser *browser;
@@ -12,15 +12,9 @@
#import "TCPConnection.h"
#define STRINGEQ(X,Y) ([X caseInsensitiveCompare:Y] == NSOrderedSame)
-#define ANNOUNCE(format, ...) [self.statusText setTitleWithMnemonic:[NSString stringWithFormat:format, ##__VA_ARGS__]];
+#define ANNOUNCE(format, ...) [statusText setTitleWithMnemonic:[NSString stringWithFormat:format, ##__VA_ARGS__]];
@implementation Catcher
-@synthesize imageView;
-@synthesize textField;
-@synthesize statusText;
-@synthesize button;
-@synthesize progress;
-@synthesize saveItem;
@synthesize imageData;
@synthesize browser;
@@ -73,12 +67,12 @@ - (void) connection:(TCPConnection*)connection didReceiveData:(NSData*)data;
success = YES;
self.imageData = data;
NSImage *image = [self imageFromData:data];
- [self.imageView setImage:image];
+ [imageView setImage:image];
- [self.saveItem setEnabled:YES];
- [self.button setEnabled:YES];
+ [saveItem setEnabled:YES];
+ [button setEnabled:YES];
- [self.progress stopAnimation:nil];
+ [progress stopAnimation:nil];
ANNOUNCE(@"Recived JPEG image (%d bytes).\n\nUse File > Save to save the received image to disk.", data.length);
}
@@ -90,10 +84,10 @@ - (void) connectionDidClose:(TCPConnection*)connection
ANNOUNCE(@"Connection denied or lost. Sorry.");
self.imageData = nil;
- [self.saveItem setEnabled:NO];
- [self.imageView setImage:nil];
- [self.button setEnabled:YES];
- [self.progress stopAnimation:nil];
+ [saveItem setEnabled:NO];
+ [imageView setImage:nil];
+ [button setEnabled:YES];
+ [progress stopAnimation:nil];
}
// Upon resolving address, create a connection to that address and request data
@@ -104,24 +98,24 @@ - (void)netServiceDidResolveAddress:(NSNetService *)netService
struct sockaddr* address = (struct sockaddr*)[[addresses objectAtIndex:0] bytes];
TCPConnection *connection = [[TCPConnection alloc] initWithRemoteAddress:address];
[connection setDelegate:self];
- [self.statusText setTitleWithMnemonic:@"Requesting data..."];
- [self.progress startAnimation:nil];
+ [statusText setTitleWithMnemonic:@"Requesting data..."];
+ [progress startAnimation:nil];
[netService release];
[connection receiveData];
}
}
// Complain when resolve fails
- (void)netService:(NSNetService *)sender didNotResolve:(NSDictionary *)errorDict {
- [self.statusText setTitleWithMnemonic:@"Error resolving service. Sorry."];
+ [statusText setTitleWithMnemonic:@"Error resolving service. Sorry."];
}
// Upon finding a service, stop the browser and resolve
- (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindService:(NSNetService *)netService moreComing:(BOOL)moreServicesComing
{
[self.browser stop];
self.browser = nil;
- [self.statusText setTitleWithMnemonic:@"Resolving service."];
+ [statusText setTitleWithMnemonic:@"Resolving service."];
[[netService retain] setDelegate:self];
[netService resolveWithTimeout:0.0f];
}
@@ -130,17 +124,17 @@ - (void)netServiceBrowser:(NSNetServiceBrowser *)netServiceBrowser didFindServic
- (IBAction) catchPlease: (id) sender
{
success = NO;
- [self.statusText setTitleWithMnemonic:@"Scanning for service"];
+ [statusText setTitleWithMnemonic:@"Scanning for service"];
self.browser = [[[NSNetServiceBrowser alloc] init] autorelease];
[self.browser setDelegate:self];
NSString *type = [TCPConnection bonjourTypeFromIdentifier:@"PictureThrow"];
[self.browser searchForServicesOfType:type inDomain:@"local"];
- [self.button setEnabled:NO];
+ [button setEnabled:NO];
self.imageData = nil;
- [self.saveItem setEnabled:NO];
- [self.imageView setImage:nil];
+ [saveItem setEnabled:NO];
+ [imageView setImage:nil];
}
// Write data to disk based on save panel settings
@@ -151,7 +145,7 @@ - (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextI
else
{
[self.imageData writeToFile:[sheet filename] atomically:YES];
- [self.saveItem setEnabled:NO];
+ [saveItem setEnabled:NO];
}
}
@@ -15,18 +15,13 @@ @interface TestBedViewController : UIViewController <BonjourHelperDataDelegate,
IBOutlet UITextView *sendView;
IBOutlet UITextView *receiveView;
}
-@property (retain) UITextView *sendView;
-@property (retain) UITextView *receiveView;
@end
@implementation TestBedViewController
-@synthesize sendView;
-@synthesize receiveView;
-
- (void)textViewDidChange:(UITextView *)textView
{
if (![BonjourHelper sharedInstance].isConnected) return;
- NSString *text = self.sendView.text;
+ NSString *text = sendView.text;
if (!text || (text.length == 0)) text = @"xyzzyclear";
NSData *textData = [text dataUsingEncoding:NSUTF8StringEncoding];
[BonjourHelper sendData:textData];
@@ -35,20 +30,20 @@ - (void)textViewDidChange:(UITextView *)textView
-(void) receivedData: (NSData *) data
{
NSString *text = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
- self.receiveView.text = [text isEqualToString:@"xyzzyclear"] ? @"" : text;
+ receiveView.text = [text isEqualToString:@"xyzzyclear"] ? @"" : text;
}
- (void) clear
{
- self.sendView.text = @"";
+ sendView.text = @"";
}
- (void) viewDidLoad
{
self.navigationController.navigationBar.tintColor = COOKBOOK_PURPLE_COLOR;
self.navigationItem.leftBarButtonItem = BARBUTTON(@"Clear", @selector(clear));
self.title = @"Let's chat";
- [self.sendView becomeFirstResponder];
+ [sendView becomeFirstResponder];
if (![BonjourHelper performWiFiCheck]) return;
@@ -16,17 +16,13 @@ @interface TestBedViewController : UIViewController <GameKitHelperDataDelegate,
IBOutlet UITextView *sendView;
IBOutlet UITextView *receiveView;
}
-@property (retain) UITextView *sendView;
-@property (retain) UITextView *receiveView;
@end
@implementation TestBedViewController
-@synthesize sendView;
-@synthesize receiveView;
- (void)textViewDidChange:(UITextView *)textView
{
- NSString *text = self.sendView.text;
+ NSString *text = sendView.text;
if (!text || (text.length == 0)) text = @"xyzzyclear";
NSData *textData = [text dataUsingEncoding:NSUTF8StringEncoding];
@@ -37,12 +33,12 @@ - (void)textViewDidChange:(UITextView *)textView
-(void) receivedData: (NSData *) data
{
NSString *text = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
- self.receiveView.text = [text isEqualToString:@"xyzzyclear"] ? @"" : text;
+ receiveView.text = [text isEqualToString:@"xyzzyclear"] ? @"" : text;
}
- (void) clear
{
- self.sendView.text = @"";
+ sendView.text = @"";
}
- (void) viewDidLoad
@@ -54,7 +50,7 @@ - (void) viewDidLoad
[GameKitHelper sharedInstance].dataDelegate = self;
[GameKitHelper assignViewController:self];
- [self.sendView becomeFirstResponder];
+ [sendView becomeFirstResponder];
}
@end
@@ -16,7 +16,6 @@ @interface TestBedViewController : UIViewController
IBOutlet UITextView *textView;
}
@property (retain) NSMutableString *log;
-@property (retain) UITextView *textView;
@end
@implementation TestBedViewController
@@ -32,7 +31,7 @@ - (void) doLog: (NSString *) formatstring, ...
va_end(arglist);
[self.log appendString:outstring];
[self.log appendString:@"\n"];
- self.textView.text = self.log;
+ textView.text = self.log;
}
- (void) action: (UIBarButtonItem *) bbi
@@ -20,12 +20,10 @@ @interface TestBedViewController : UIViewController
IBOutlet UITextView *textView;
}
@property (retain) NSMutableString *log;
-@property (retain) UITextView *textView;
@end
@implementation TestBedViewController
@synthesize log;
-@synthesize textView;
// Direct from Apple. Thank you Apple
- (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)address
@@ -98,7 +96,7 @@ - (void) doLog: (NSString *) formatstring, ...
va_end(arglist);
[self.log appendString:outstring];
[self.log appendString:@"\n"];
- self.textView.text = self.log;
+ textView.text = self.log;
}
#define CHECK(SITE) [self doLog:@"%@ : %@", SITE, [self hostAvailable:SITE] ? @"available" : @"not available"];
@@ -17,13 +17,11 @@ @interface TestBedViewController : UIViewController
NSString *savePath;
}
@property (retain) NSMutableString *log;
-@property (retain) UITextView *textView;
@property (retain) NSString *savePath;
@end
@implementation TestBedViewController
@synthesize log;
-@synthesize textView;
@synthesize savePath;
// relatively short movie (3 MB)
@@ -60,7 +58,7 @@ - (void) doLog: (NSString *) formatstring, ...
va_end(arglist);
[self.log appendString:outstring];
[self.log appendString:@"\n"];
- [self.textView performSelectorOnMainThread:@selector(setText:) withObject:self.log waitUntilDone:NO];
+ [textView performSelectorOnMainThread:@selector(setText:) withObject:self.log waitUntilDone:NO];
}
- (void) finishedGettingData
@@ -19,15 +19,11 @@ @interface TestBedViewController : UIViewController
NSString *savePath;
}
@property (retain) NSMutableString *log;
-@property (retain) UITextView *textView;
-@property (retain) UIProgressView *progress;
@property (retain) NSString *savePath;
@end
@implementation TestBedViewController
@synthesize log;
-@synthesize textView;
-@synthesize progress;
@synthesize savePath;
#define SMALL_URL @"http://www.archive.org/download/Drive-inSaveFreeTv/Drive-in--SaveFreeTv_512kb.mp4"
@@ -58,7 +54,7 @@ - (void) doLog: (NSString *) formatstring, ...
va_end(arglist);
[self.log appendString:outstring];
[self.log appendString:@"\n"];
- [self.textView setText:self.log];
+ [textView setText:self.log];
}
- (void) restoreGUI
@@ -68,13 +64,13 @@ - (void) restoreGUI
self.navigationItem.leftBarButtonItem = BARBUTTON(@"Play", @selector(startPlayback:));
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
[(UISegmentedControl *)self.navigationItem.titleView setEnabled:YES];
- [self.progress setHidden:YES];
+ [progress setHidden:YES];
}
- (void) dataDownloadAtPercent: (NSNumber *) aPercent
{
- [self.progress setHidden:NO];
- [self.progress setProgress:[aPercent floatValue]];
+ [progress setHidden:NO];
+ [progress setProgress:[aPercent floatValue]];
}
- (void) dataDownloadFailed: (NSString *) reason
Oops, something went wrong.

0 comments on commit 5d3df10

Please sign in to comment.