Created
November 29, 2012 09:58
-
-
Save 20m61/4167917 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
// 121129 | |
// | |
// Created by changhwi on 12/11/29. | |
// Copyright (c) 2012年 changhwi. All rights reserved. | |
// | |
#import "ViewController.h" | |
@interface ViewController () | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view, typically from a nib. | |
valueR = 1.0; | |
valueG = 1.0; | |
valueB = 1.0; | |
valueA = 1.0; | |
} | |
- (void)didReceiveMemoryWarning | |
{ | |
[super didReceiveMemoryWarning]; | |
// Dispose of any resources that can be recreated. | |
} | |
//textFieldの数字を更新 | |
-(void)textFieldUpdate{ | |
_textField.text = [NSString stringWithFormat:@"%d", count]; | |
} | |
-(void)viewUpdate{[ | |
UIView | |
animateWithDuration:0.5 | |
animations:^{self.view.backgroundColor = [UIColor colorWithRed:valueR green:valueG blue:valueB alpha:1]; | |
}]; | |
} | |
-(void)buttonRPlusColorChenge{ | |
if (valueR >= 1.0) { | |
[UIView | |
animateWithDuration:0.1 | |
animations:^{self.buttonRPlusOutlet.backgroundColor = | |
[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:1.0];}]; | |
} | |
else{ | |
[UIView | |
animateWithDuration:0.1 | |
animations:^{self.buttonRPlusOutlet.backgroundColor = | |
[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];}]; | |
} | |
} | |
- (IBAction)buttonUfo:(id)sender { | |
} | |
#pragma mark - buttonR | |
- (IBAction)buttonRPlus:(id)sender { | |
if (count >= 0) { | |
count++; | |
} | |
if (valueR <= 1.0) { | |
valueR += 0.1; | |
} | |
NSLog(@"%f", valueR); | |
[self textFieldUpdate]; | |
[self viewUpdate]; | |
[self buttonRPlusColorChenge]; | |
} | |
- (IBAction)buttonRMinus:(id)sender { | |
if (count > 0) { | |
count--; | |
} | |
if (valueR >= 0.0) { | |
valueR -= 0.1; | |
} | |
NSLog(@"%f", valueR); | |
[self textFieldUpdate]; | |
[self viewUpdate]; | |
[self buttonRPlusColorChenge]; | |
} | |
#pragma mark - buttonG | |
- (IBAction)buttonGPlus:(id)sender { | |
if (count >= 0) { | |
count++; | |
} | |
if (valueG <= 1.0) { | |
valueG += 0.1; | |
} | |
NSLog(@"%f", valueG); | |
[self textFieldUpdate]; | |
[self viewUpdate]; | |
} | |
- (IBAction)buttonGMinus:(id)sender { | |
if (count > 0) { | |
count--; | |
} | |
if (valueG >= 0.0) { | |
valueG -= 0.1; | |
} | |
NSLog(@"%f", valueG); | |
[self textFieldUpdate]; | |
[self viewUpdate]; | |
} | |
#pragma mark - buttonB | |
- (IBAction)buttonBPlus:(id)sender { | |
if (count >= 0) { | |
count++; | |
} | |
if (valueB <= 1.0) { | |
valueB += 0.1; | |
} | |
NSLog(@"%f", valueB); | |
[self textFieldUpdate]; | |
[self viewUpdate]; | |
} | |
- (IBAction)buttonBMinus:(id)sender { | |
if (count > 0) { | |
count--; | |
} | |
if (valueB >= 0.0) { | |
valueB -= 0.1; | |
} | |
NSLog(@"%f", valueB); | |
[self textFieldUpdate]; | |
[self viewUpdate]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment