Created
November 27, 2012 10:42
-
-
Save 20m61/4153574 to your computer and use it in GitHub Desktop.
counter+RGB
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
// | |
// ViewController.m | |
// 121126 | |
// | |
// Created by changhwi on 12/11/26. | |
// Copyright (c) 2012年 changhwi. All rights reserved. | |
// | |
#import "ViewController.h" | |
@interface ViewController () | |
@end | |
@implementation ViewController | |
@synthesize textField; | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
- (void)didReceiveMemoryWarning | |
{ | |
[super didReceiveMemoryWarning]; | |
// Dispose of any resources that can be recreated. | |
} | |
- (void)updateTextField{ | |
[UIView animateWithDuration:0.5 // 何秒かけてアニメーションするか | |
animations:^{ | |
self.view.backgroundColor = [UIColor | |
colorWithRed:cR green:cG | |
blue:cB | |
alpha:1]; | |
}]; | |
textField.text = [NSString stringWithFormat:@"%4d", counter]; | |
textField.text = [NSString stringWithFormat:@"%4f", cR]; | |
} | |
- (IBAction)bottunRUpper:(id)sender { | |
if (cR <= 1) { | |
cR = cR + chengeColor; | |
} | |
counter = counter + 1; | |
[self updateTextField]; | |
} | |
- (IBAction)bottunRBottum:(id)sender { | |
if (cR >= 0) { | |
cR = cR - chengeColor; | |
} | |
counter = counter + 1; | |
[self updateTextField]; | |
} | |
- (IBAction)bottunGUpper:(id)sender { | |
if (cG <= 1) { | |
cG = cG + chengeColor; | |
} | |
counter = counter - 1; | |
[self updateTextField]; | |
} | |
- (IBAction)bottunGBottum:(id)sender { | |
if (cG >= 0) { | |
cG = cG - chengeColor; | |
} | |
else{ | |
// @selector(bottunColor); | |
} | |
counter = counter - 1; | |
[self updateTextField]; | |
} | |
- (IBAction)buttonBUpper:(id)sender { | |
if (cB >= 0) { | |
cB = cB - chengeColor; | |
} | |
counter = 0; | |
[self updateTextField]; | |
} | |
- (IBAction)bottunBBottum:(id)sender { | |
if (cB >= 0) { | |
cB = cB - chengeColor; | |
} | |
counter = 0; | |
[self updateTextField]; | |
} | |
- (IBAction)UFO:(id)sender { | |
cR = 1; | |
cG = 1; | |
cB = 1; | |
[self updateTextField]; | |
} | |
- (void)bottunColor{ | |
bottunGBottum.backgroundColor = [UIColor blueColor]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment