Skip to content

Instantly share code, notes, and snippets.

@20m61
Created November 28, 2012 10:08
Show Gist options
  • Save 20m61/4160277 to your computer and use it in GitHub Desktop.
Save 20m61/4160277 to your computer and use it in GitHub Desktop.
//
// 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;
@synthesize bottunGBottumOutlet;
- (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;
}
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{
bottunGBottumOutlet.backgroundColor = [UIColor blueColor];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment