Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 92 lines (65 sloc) 2.666 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
    //
// SCPieProgressViewDemoViewController.m
// SSCatalog
//
// Created by Sam Soffes on 4/22/10.
// Copyright 2010 Sam Soffes, Inc. All rights reserved.
//

#import "SCPieProgressViewDemoViewController.h"

@implementation SCPieProgressViewDemoViewController {
SSPieProgressView *_progressView7;
NSTimer *_timer;
}


#pragma mark - Class Methods

+ (NSString *)title {
return @"Pie Progress View";
}


#pragma mark - NSObject

- (void)dealloc {
[_timer invalidate];
}


#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];

SSPieProgressView *progressView1 = [[SSPieProgressView alloc] initWithFrame:CGRectMake(20.0f, 20.0f, 55.0f, 55.0f)];
progressView1.progress = 0.25;
[self.view addSubview:progressView1];

SSPieProgressView *progressView2 = [[SSPieProgressView alloc] initWithFrame:CGRectMake(95.0f, 20.0f, 55.0f, 55.0f)];
progressView2.progress = 0.50;
[self.view addSubview:progressView2];

SSPieProgressView *progressView3 = [[SSPieProgressView alloc] initWithFrame:CGRectMake(170.0f, 20.0f, 55.0f, 55.0f)];
progressView3.progress = 0.75;
[self.view addSubview:progressView3];

SSPieProgressView *progressView4 = [[SSPieProgressView alloc] initWithFrame:CGRectMake(245.0f, 20.0f, 55.0f, 55.0f)];
progressView4.progress = 1.0;
[self.view addSubview:progressView4];

SSPieProgressView *progressView5 = [[SSPieProgressView alloc] initWithFrame:CGRectMake(20.0f, 95.0f, 130.0f, 130.0f)];
progressView5.progress = 0.33;
[self.view addSubview:progressView5];

SSPieProgressView *progressView6 = [[SSPieProgressView alloc] initWithFrame:CGRectMake(170.0f, 95.0f, 130.0f, 130.0f)];
progressView6.progress = 0.66;
[self.view addSubview:progressView6];

_progressView7 = [[SSPieProgressView alloc] initWithFrame:CGRectMake(95.0f, 245.0f, 130.0f, 130.0f)];
[self.view addSubview:_progressView7];

_timer = [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(incrementProgress:) userInfo:nil repeats:YES];
}


- (void)viewDidUnload {
[super viewDidUnload];
[_timer invalidate];
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
return toInterfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
}
return YES;
}


#pragma mark - Timer

- (void)incrementProgress:(NSTimer *)timer {
_progressView7.progress = _progressView7.progress + 0.01;
if (_progressView7.progress == 1.0f) {
_progressView7.progress = 0.0;
}
}

@end
Something went wrong with that request. Please try again.