Permalink
Browse files

Modernize catalog

  • Loading branch information...
1 parent eea5a5c commit dfb898ab0118f949a043cb51a6126b8ab238300d @soffes committed May 8, 2012
@@ -53,8 +53,6 @@ - (void)viewDidLoad {
[NSDictionary dictionaryWithObjectsAndKeys:
[NSArray arrayWithObjects:
@"SCAddressBarDemoViewController",
- @"SCSegmentedControlDemoViewController",
- @"SCSwitchDemoViewController",
nil], kClassesKey,
@"Controls", kTitleKey,
nil],
@@ -1,15 +0,0 @@
-//
-// SCSegmentedControlDemoViewController.h
-// SSCatalog
-//
-// Created by Sam Soffes on 2/14/11.
-// Copyright 2011 Sam Soffes. All rights reserved.
-//
-
-@interface SCSegmentedControlDemoViewController : UIViewController
-
-+ (NSString *)title;
-
-- (void)valueChanged:(id)sender;
-
-@end
@@ -1,100 +0,0 @@
-//
-// SCSegmentedControlDemoViewController.m
-// SSCatalog
-//
-// Created by Sam Soffes on 2/14/11.
-// Copyright 2011 Sam Soffes. All rights reserved.
-//
-
-#import "SCSegmentedControlDemoViewController.h"
-
-@implementation SCSegmentedControlDemoViewController {
- UISegmentedControl *_systemSegmentedControl;
- SSSegmentedControl *_customSegmentedControl;
-}
-
-
-#pragma mark - Class Methods
-
-+ (NSString *)title {
- return @"Segmented Control";
-}
-
-
-#pragma mark - NSObject
-
-- (void)dealloc {
- [_systemSegmentedControl release];
- [_customSegmentedControl 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];
-
- UIFont *labelFont = [UIFont boldSystemFontOfSize:15.0f];
- NSArray *items = [NSArray arrayWithObjects:@"Apples", @"Oranges", [UIImage imageNamed:@"SamLogo.png"], nil];
-
- // System segmented control
- UILabel *systemLabel = [[UILabel alloc] initWithFrame:CGRectMake(20.0f, 20.0f, 280.0f, 20.0f)];
- systemLabel.text = @"UISegmentedControl";
- systemLabel.font = labelFont;
- systemLabel.backgroundColor = self.view.backgroundColor;
- systemLabel.shadowColor = [UIColor whiteColor];
- systemLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
- [self.view addSubview:systemLabel];
- [systemLabel release];
-
- _systemSegmentedControl = [[UISegmentedControl alloc] initWithItems:items];
- _systemSegmentedControl.frame = CGRectMake(20.0f, 50.0f, 280.0f, 32.0f);
- _systemSegmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
- _systemSegmentedControl.selectedSegmentIndex = 0;
- [_systemSegmentedControl setEnabled:NO forSegmentAtIndex:1];
- [_systemSegmentedControl addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
- [self.view addSubview:_systemSegmentedControl];
-
- // Custom segmented control
- UILabel *customLabel = [[UILabel alloc] initWithFrame:CGRectMake(20.0f, 107.0f, 280.0f, 20.0f)];
- customLabel.text = @"SSSegmentedControl";
- customLabel.font = labelFont;
- customLabel.backgroundColor = self.view.backgroundColor;
- customLabel.shadowColor = [UIColor whiteColor];
- customLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
- [self.view addSubview:customLabel];
- [customLabel release];
-
- _customSegmentedControl = [[SSSegmentedControl alloc] initWithItems:items];
- _customSegmentedControl.frame = CGRectMake(20.0f, 137.0f, 280.0f, 32.0f);
- _customSegmentedControl.selectedSegmentIndex = 0;
- [_customSegmentedControl setEnabled:NO forSegmentAtIndex:1];
- [_customSegmentedControl addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
- [self.view addSubview:_customSegmentedControl];
-}
-
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
- return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
- }
- return YES;
-}
-
-
-#pragma mark - Actions
-
-- (void)valueChanged:(id)sender {
- NSLog(@"Value changed to %i", [sender selectedSegmentIndex]);
-
- if (sender == _systemSegmentedControl) {
- _customSegmentedControl.selectedSegmentIndex = _systemSegmentedControl.selectedSegmentIndex;
- } else {
- _systemSegmentedControl.selectedSegmentIndex = _customSegmentedControl.selectedSegmentIndex;
- }
-}
-
-@end
@@ -1,14 +0,0 @@
-//
-// SCSwitchDemoViewController.h
-// SSCatalog
-//
-// Created by Sam Soffes on 11/19/10.
-// Copyright 2010 Sam Soffes. All rights reserved.
-//
-
-@interface SCSwitchDemoViewController : UIViewController
-
-+ (NSString *)title;
-
-@end
-
@@ -1,97 +0,0 @@
-//
-// SCSwitchDemoViewController.m
-// SSCatalog
-//
-// Created by Sam Soffes on 11/19/10.
-// Copyright 2010 Sam Soffes. All rights reserved.
-//
-
-#import "SCSwitchDemoViewController.h"
-
-@implementation SCSwitchDemoViewController
-
-#pragma mark - Class Methods
-
-+ (NSString *)title {
- return @"Switch";
-}
-
-
-#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];
-
- UIFont *labelFont = [UIFont boldSystemFontOfSize:15.0f];
-
- // System switch
- UILabel *systemLabel = [[UILabel alloc] initWithFrame:CGRectMake(20.0f, 20.0f, 280.0f, 20.0f)];
- systemLabel.text = @"Standard UISwitch";
- systemLabel.font = labelFont;
- systemLabel.backgroundColor = self.view.backgroundColor;
- systemLabel.shadowColor = [UIColor whiteColor];
- systemLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
- [self.view addSubview:systemLabel];
- [systemLabel release];
-
- UISwitch *systemOffSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(20.0f, 50.0f, 94.0f, 27.0f)];
- [self.view addSubview:systemOffSwitch];
- [systemOffSwitch release];
-
- UISwitch *systemOnSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(134.0f, 50.0f, 94.0f, 27.0f)];
- systemOnSwitch.on = YES;
- [self.view addSubview:systemOnSwitch];
- [systemOnSwitch release];
-
- // Default style
- UILabel *defaultLabel = [[UILabel alloc] initWithFrame:CGRectMake(20.0f, 107.0f, 280.0f, 20.0f)];
- defaultLabel.text = @"SSSwitchStyleDefault";
- defaultLabel.font = labelFont;
- defaultLabel.backgroundColor = self.view.backgroundColor;
- defaultLabel.shadowColor = [UIColor whiteColor];
- defaultLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
- [self.view addSubview:defaultLabel];
- [defaultLabel release];
-
- SSSwitch *defaultOffSwitch = [[SSSwitch alloc] initWithFrame:CGRectMake(20.0f, 137.0f, 94.0f, 27.0f)];
- [self.view addSubview:defaultOffSwitch];
- [defaultOffSwitch release];
-
- SSSwitch *defaultOnSwitch = [[SSSwitch alloc] initWithFrame:CGRectMake(134.0f, 137.0f, 94.0f, 27.0f)];
- defaultOnSwitch.on = YES;
- [self.view addSubview:defaultOnSwitch];
- [defaultOnSwitch release];
-
- // Airplane mode style
- UILabel *airplaneLabel = [[UILabel alloc] initWithFrame:CGRectMake(20.0f, 194.0f, 280.0f, 20.0f)];
- airplaneLabel.text = @"SSSwitchStyleAirplane";
- airplaneLabel.font = labelFont;
- airplaneLabel.backgroundColor = self.view.backgroundColor;
- airplaneLabel.shadowColor = [UIColor whiteColor];
- airplaneLabel.shadowOffset = CGSizeMake(0.0f, 1.0f);
- [self.view addSubview:airplaneLabel];
- [airplaneLabel release];
-
- SSSwitch *airplaneOffSwitch = [[SSSwitch alloc] initWithFrame:CGRectMake(20.0f, 224.0f, 94.0f, 27.0f)];
- airplaneOffSwitch.style = SSSwitchStyleAirplane;
- [self.view addSubview:airplaneOffSwitch];
- [airplaneOffSwitch release];
-
- SSSwitch *airplaneOnSwitch = [[SSSwitch alloc] initWithFrame:CGRectMake(134.0f, 224.0f, 94.0f, 27.0f)];
- airplaneOnSwitch.style = SSSwitchStyleAirplane;
- airplaneOnSwitch.on = YES;
- [self.view addSubview:airplaneOnSwitch];
- [airplaneOnSwitch release];
-}
-
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
- return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
- }
- return YES;
-}
-
-@end
Oops, something went wrong.

0 comments on commit dfb898a

Please sign in to comment.