Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit c369c92c31c6771e995eb3dee4b887e4da3cb48a @soffes committed Oct 22, 2011
Showing with 2,399 additions and 0 deletions.
  1. +13 −0 Classes/SCAddressBarDemoViewController.h
  2. +157 −0 Classes/SCAddressBarDemoViewController.m
  3. +14 −0 Classes/SCAppDelegate.h
  4. +51 −0 Classes/SCAppDelegate.m
  5. +13 −0 Classes/SCBadgeTableViewCellDemoViewController.h
  6. +116 −0 Classes/SCBadgeTableViewCellDemoViewController.m
  7. +13 −0 Classes/SCCollectionViewDemoViewController.h
  8. +100 −0 Classes/SCCollectionViewDemoViewController.m
  9. +16 −0 Classes/SCGradientViewDemoViewController.h
  10. +102 −0 Classes/SCGradientViewDemoViewController.m
  11. +16 −0 Classes/SCHUDViewDemoViewController.h
  12. +71 −0 Classes/SCHUDViewDemoViewController.m
  13. +15 −0 Classes/SCImageCollectionViewItem.h
  14. +54 −0 Classes/SCImageCollectionViewItem.m
  15. +13 −0 Classes/SCLineViewDemoViewController.h
  16. +57 −0 Classes/SCLineViewDemoViewController.m
  17. +13 −0 Classes/SCLoadingViewDemoViewController.h
  18. +43 −0 Classes/SCLoadingViewDemoViewController.m
  19. +15 −0 Classes/SCPickerDemoViewController.h
  20. +99 −0 Classes/SCPickerDemoViewController.m
  21. +10 −0 Classes/SCPickerDetailViewController.h
  22. +54 −0 Classes/SCPickerDetailViewController.m
  23. +15 −0 Classes/SCPieProgressViewDemoViewController.h
  24. +102 −0 Classes/SCPieProgressViewDemoViewController.m
  25. +11 −0 Classes/SCRootViewController.h
  26. +125 −0 Classes/SCRootViewController.m
  27. +15 −0 Classes/SCSegmentedControlDemoViewController.h
  28. +100 −0 Classes/SCSegmentedControlDemoViewController.m
  29. +14 −0 Classes/SCSwitchDemoViewController.h
  30. +97 −0 Classes/SCSwitchDemoViewController.m
  31. +13 −0 Classes/SSRatingDemoViewController.h
  32. +27 −0 Classes/SSRatingDemoViewController.m
  33. +14 −0 Other Sources/SSCatalog_Prefix.pch
  34. +15 −0 Other Sources/main.m
  35. +7 −0 Readme.markdown
  36. BIN Resources/Default-Landscape~ipad.png
  37. BIN Resources/Default-Portrait~ipad.png
  38. BIN Resources/Default.png
  39. BIN Resources/Default@2x.png
  40. BIN Resources/Icon-114.png
  41. BIN Resources/Icon-29.png
  42. BIN Resources/Icon-48.png
  43. BIN Resources/Icon-72.png
  44. BIN Resources/Icon.png
  45. +59 −0 Resources/SSCatalog-Info.plist
  46. BIN Resources/SamLogo.png
  47. BIN Resources/SamLogo@2x.png
  48. BIN Resources/iTunesArtwork
  49. +611 −0 SSCatalog.xcodeproj/project.pbxproj
  50. +7 −0 SSCatalog.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  51. BIN ...log.xcodeproj/project.xcworkspace/xcuserdata/samsoffes.xcuserdatad/UserInterfaceState.xcuserstate
  52. +10 −0 ...talog.xcodeproj/project.xcworkspace/xcuserdata/samsoffes.xcuserdatad/WorkspaceSettings.xcsettings
  53. +5 −0 SSCatalog.xcodeproj/xcuserdata/samsoffes.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  54. +75 −0 SSCatalog.xcodeproj/xcuserdata/samsoffes.xcuserdatad/xcschemes/SSCatalog.xcscheme
  55. +22 −0 SSCatalog.xcodeproj/xcuserdata/samsoffes.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,13 @@
+//
+// SCAddressBarDemoViewController.h
+// SSCatalog
+//
+// Created by Sam Soffes on 2/8/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+@interface SCAddressBarDemoViewController : UIViewController <UITextFieldDelegate, SSWebViewDelegate>
+
++ (NSString *)title;
+
+@end
@@ -0,0 +1,157 @@
+//
+// SCAddressBarDemoViewController.m
+// SSCatalog
+//
+// Created by Sam Soffes on 2/8/11.
+// Copyright 2011 Sam Soffes. All rights reserved.
+//
+
+#import "SCAddressBarDemoViewController.h"
+
+@implementation SCAddressBarDemoViewController {
+ SSGradientView *_headerView;
+ UILabel *_titleLabel;
+ SSAddressBarTextField *_addressBar;
+ SSWebView *_webView;
+}
+
+
+#pragma mark - Class Methods
+
++ (NSString *)title {
+ return @"Address bar";
+}
+
+
+#pragma mark - NSObject
+
+- (void)dealloc {
+ _webView.delegate = nil;
+ [_webView release];
+ [_headerView release];
+ [_titleLabel release];
+ [_addressBar release];
+ [super dealloc];
+}
+
+
+#pragma mark - UIViewController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.title = [[self class] title];
+ self.view.backgroundColor = [UIColor colorWithRed:0.851f green:0.859f blue:0.882f alpha:1.0f];
+
+ CGSize size = self.view.frame.size;
+
+ _headerView = [[SSGradientView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, size.width, 58.0f)];
+ _headerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+ _headerView.topColor = [UIColor colorWithWhite:0.957f alpha:1.0f];
+ _headerView.bottomColor = [UIColor colorWithWhite:0.827f alpha:1.0f];
+ _headerView.bottomBorderColor = [UIColor colorWithWhite:0.369f alpha:1.0f];
+
+ _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10.0f, 0.0f, size.width - 20.0f, 21.0f)];
+ _titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+ _titleLabel.backgroundColor = [UIColor clearColor];
+ _titleLabel.textColor = [UIColor colorWithWhite:0.404f alpha:1.0f];
+ _titleLabel.textAlignment = UITextAlignmentCenter;
+ _titleLabel.font = [UIFont boldSystemFontOfSize:12.0f];
+ _titleLabel.shadowColor = [UIColor whiteColor];
+ _titleLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
+ [_headerView addSubview:_titleLabel];
+
+ _addressBar = [[SSAddressBarTextField alloc] initWithFrame:CGRectMake(10.0f, 21.0f, size.width - 20.0f, 31.0f)];
+ _addressBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+ _addressBar.delegate = self;
+ [_headerView addSubview:_addressBar];
+
+ [self.view addSubview:_headerView];
+
+ _webView = [[SSWebView alloc] initWithFrame:CGRectMake(0.0f, 58.0f, size.width, size.height - 58.0f)];
+ _webView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+ _webView.scalesPageToFit = YES;
+ _webView.delegate = self;
+ [self.view addSubview:_webView];
+
+ [_addressBar.reloadButton addTarget:_webView action:@selector(reload) forControlEvents:UIControlEventTouchUpInside];
+ [_addressBar.stopButton addTarget:_webView action:@selector(stopLoading) forControlEvents:UIControlEventTouchUpInside];
+
+ [_webView loadURLString:@"http://samsoff.es"];
+}
+
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+ return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
+ }
+ return YES;
+}
+
+
+#pragma mark - UITextFieldDelegate
+
+- (void)textFieldDidBeginEditing:(UITextField *)textField {
+ [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(_removeGrayView) object:nil];
+
+ // Gray Button
+// UIButton *aGrayButton = [UIButton buttonWithType:UIButtonTypeCustom];
+// aGrayButton.frame = _webView.frame;
+// aGrayButton.backgroundColor = [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f];
+// aGrayButton.alpha = 0.0f;
+// aGrayButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+// [aGrayButton addTarget:textField action:@selector(resignFirstResponder) forControlEvents:UIControlEventTouchDown];
+// self.grayButton = aGrayButton;
+// [self.view addSubview:grayButton];
+// [grayButton fadeIn];
+}
+
+
+- (void)textFieldDidEndEditing:(UITextField *)textField {
+// [self performSelector:@selector(_removeGrayView) withObject:nil afterDelay:0.1];
+}
+
+
+- (BOOL)textFieldShouldReturn:(UITextField *)textField {
+ [_webView loadURLString:textField.text];
+ [textField resignFirstResponder];
+ return YES;
+}
+
+
+#pragma mark - SSWebViewDelegate
+
+- (void)webViewDidStartLoadingPage:(SSWebView *)aWebView {
+ _addressBar.loading = YES;
+ [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
+
+ NSString *urlString = [[[_webView lastRequest] mainDocumentURL] absoluteString];
+
+ static NSRegularExpression *regularExpression = nil;
+ if (!regularExpression) {
+ regularExpression = [[NSRegularExpression alloc] initWithPattern:@"^https?://" options:NSRegularExpressionCaseInsensitive error:nil];
+ }
+
+ NSString *addressBarUrlString = [regularExpression stringByReplacingMatchesInString:urlString options:0 range:NSMakeRange(0, [urlString length]) withTemplate:@""];
+ _addressBar.text = addressBarUrlString;
+ _titleLabel.text = urlString;
+}
+
+
+- (void)webViewDidFinishLoadingPage:(SSWebView *)aWebView {
+ _addressBar.loading = NO;
+ [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
+
+ NSString *title = [_webView stringByEvaluatingJavaScriptFromString:@"document.title"];
+ if (title) {
+ _titleLabel.text = title;
+ }
+}
+
+
+- (void)webView:(SSWebView *)aWebView didFailLoadWithError:(NSError *)error {
+ _addressBar.loading = NO;
+ [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
+}
+
+
+@end
@@ -0,0 +1,14 @@
+//
+// SCAppDelegate.h
+// SSCatalog
+//
+// Created by Sam Soffes on 9/21/09.
+// Copyright 2009 Sam Soffes, Inc. All rights reserved.
+//
+
+@interface SCAppDelegate : NSObject <UIApplicationDelegate>
+
+@property (nonatomic, retain) UIWindow *window;
+@property (nonatomic, retain) UINavigationController *navigationController;
+
+@end
@@ -0,0 +1,51 @@
+//
+// SCAppDelegate.m
+// SSCatalog
+//
+// Created by Sam Soffes on 9/21/09.
+// Copyright 2009 Sam Soffes, Inc. All rights reserved.
+//
+
+#import "SCAppDelegate.h"
+#import "SCRootViewController.h"
+
+@implementation SCAppDelegate {
+ UIWindow *_window;
+ UINavigationController *_navigationController;
+}
+
+
+#pragma mark - Accessors
+
+@synthesize window = _window;
+@synthesize navigationController = _navigationController;
+
+
+#pragma mark - NSObject
+
+- (void)dealloc {
+ [_navigationController release];
+ [_window release];
+ [super dealloc];
+}
+
+
+#pragma mark - UIApplicationDelegate
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application {
+
+ _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+
+ SCRootViewController *viewController = [[SCRootViewController alloc] initWithStyle:UITableViewStyleGrouped];
+ UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
+
+ self.navigationController = aNavigationController;
+
+ [viewController release];
+ [aNavigationController release];
+
+ [_window addSubview:_navigationController.view];
+ [_window makeKeyAndVisible];
+}
+
+@end
@@ -0,0 +1,13 @@
+//
+// SCBadgeTableViewCellDemoViewController.m
+// SSCatalog
+//
+// Created by Sam Soffes on 01/29/11.
+// Copyright 2011 Sam Soffes, Inc. All rights reserved.
+//
+
+@interface SCBadgeTableViewCellDemoViewController : UITableViewController
+
++ (NSString *)title;
+
+@end
@@ -0,0 +1,116 @@
+//
+// SCBadgeTableViewCellDemoViewController.m
+// SSCatalog
+//
+// Created by Sam Soffes on 01/29/11.
+// Copyright 2011 Sam Soffes, Inc. All rights reserved.
+//
+
+#import "SCBadgeTableViewCellDemoViewController.h"
+
+@implementation SCBadgeTableViewCellDemoViewController
+
+#pragma mark - Class Methods
+
++ (NSString *)title {
+ return @"Badge Table View Cell";
+}
+
+
+#pragma mark - NSObject
+
+- (id)init {
+ return self = [super initWithStyle:UITableViewStyleGrouped];
+}
+
+
+#pragma mark - UIViewController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ self.title = [[self class] title];
+}
+
+
+- (void)viewWillAppear:(BOOL)animated {
+ [super viewWillAppear:animated];
+ [self.tableView reloadData];
+}
+
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
+ return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
+ }
+ return YES;
+}
+
+
+#pragma mark - UITableViewDataSource
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+ return 2;
+}
+
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ return (section == 0) ? 4 : 12;
+}
+
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ static NSString *cellIdentifier = @"cell";
+
+ SSBadgeTableViewCell *cell = (SSBadgeTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
+ if (cell == nil) {
+ cell = [[[SSBadgeTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier] autorelease];
+ }
+
+ if (indexPath.section == 0) {
+ switch (indexPath.row) {
+ case 0: {
+ cell.textLabel.text = @"Default Badge View";
+ cell.badgeView.textLabel.text = @"0";
+ cell.badgeView.badgeColor = [SSBadgeView defaultBadgeColor];
+ break;
+ }
+
+ case 1: {
+ cell.textLabel.text = @"Unread Count";
+ cell.badgeView.textLabel.text = @"3";
+ cell.badgeView.badgeColor = [UIColor colorWithRed:0.969f green:0.082f blue:0.078f alpha:1.0f];
+ break;
+ }
+
+ case 2: {
+ cell.textLabel.text = @"Text Badge";
+ cell.badgeView.textLabel.text = @"New";
+ cell.badgeView.badgeColor = [UIColor colorWithRed:0.388f green:0.686f blue:0.239f alpha:1.0f];
+ break;
+ }
+
+ case 3: {
+ cell.textLabel.text = @"Nil value";
+ cell.badgeView.textLabel.text = nil;
+ cell.badgeView.badgeColor = [SSBadgeView defaultBadgeColor];
+ break;
+ }
+ }
+ } else {
+ NSNumber *number = [NSNumber numberWithInteger:indexPath.row * 256];
+ cell.textLabel.text = [[NSNumberFormatter localizedStringFromNumber:number numberStyle:NSNumberFormatterSpellOutStyle] capitalizedString];
+ cell.badgeView.textLabel.text = [NSNumberFormatter localizedStringFromNumber:number numberStyle:NSNumberFormatterDecimalStyle];
+ cell.badgeView.badgeColor = [SSBadgeView defaultBadgeColor];
+ }
+
+ return cell;
+}
+
+
+#pragma mark - UITableViewDelegate
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+ [tableView deselectRowAtIndexPath:indexPath animated:YES];
+}
+
+@end
@@ -0,0 +1,13 @@
+//
+// SCCollectionViewDemoViewController.h
+// SSCatalog
+//
+// Created by Sam Soffes on 8/24/10.
+// Copyright 2010 Sam Soffes. All rights reserved.
+//
+
+@interface SCCollectionViewDemoViewController : SSCollectionViewController
+
++ (NSString *)title;
+
+@end
Oops, something went wrong.

0 comments on commit c369c92

Please sign in to comment.