//声明非原创

步骤:

1.打开Xcode,单机Creat a new Xcode project

2.左边选择ios下Application,右边选择single view Application

3.填写项目名称单机Next

4.ViewController.h中定义成员和方法

//
// ViewController.h
// TestCalculator4
//
// Created by heyonggang on 13-11-28.
// Copyright (c) 2013年 MiracleHe. All rights reserved.
// #import <UIKit/UIKit.h> @interface ViewController : UIViewController @property(retain,nonatomic) UIButton *button;
@property(retain,nonatomic) UILabel *label;
@property(retain,nonatomic) NSMutableString *string; //NSMutableString用来处理可变对象,如需要处理字符串并更改字符串中的字符
@property(assign,nonatomic) double num1,num2;
@property(assign,nonatomic) NSString *str; @end

5.ViewController.m

//
// ViewController.m
// TestCalculator4
//
// Created by heyonggang on 13-11-28.
// Copyright (c) 2013年 MiracleHe. All rights reserved.
// #import "ViewController.h"
#import <QuartzCore/QuartzCore.h> @interface ViewController () @end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad]; //创建标签
self.label=[[UILabel alloc]initWithFrame:CGRectMake(90, 40, 200, 50)];
[self.view addSubview:_label];
self.label.backgroundColor=[UIColor greenColor]; //设置背景颜色
self.label.textColor=[UIColor blackColor]; //字体颜色
//self.label.textAlignment = UITextAlignmentRight; //字体居右
self.label.textAlignment = NSTextAlignmentCenter;
self.label.font=[UIFont systemFontOfSize:32.4]; //设置字体 //添加1-9数字
NSArray *array=[NSArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9", nil];
int n=0;
for (int i=0; i<3; i++)
{
for (int j=0; j<3; j++)
{
self.button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
self.button.frame=CGRectMake(30+65*j, 150+65*i, 60, 60);
[self.button setTitle:[array objectAtIndex:n++] forState:UIControlStateNormal]; //注意:[array objectAtIndex:n++]
[self.view addSubview:_button];
[self.button addTarget:self action:@selector(shuzi:) forControlEvents:UIControlEventTouchUpInside]; //addTarget:self 的意思是说,这个方法在本类中也可以传入其他类的指针
}
} //单独添加0
UIButton *button0=[UIButton buttonWithType:UIButtonTypeCustom]; //创建一个圆角矩形的按钮
/*
CALayer *layer = button0.layer;
[layer setMasksToBounds:YES];
[layer setCornerRadius:5.0];
button0.layer.borderColor = [UIColor lightGrayColor].CGColor;
button0.layer.borderWidth = 1.0f;
*/
[button0 setFrame:CGRectMake(30, 345, 60, 60)]; //设置button在view上的位置
//也可以这样用:button0.frame:CGRectMake(30, 345, 60, 60);
[button0 setTitle:@"0" forState:UIControlStateNormal]; //设置button主题
button0.titleLabel.textColor = [UIColor blackColor]; //设置0键的颜色
[button0 addTarget:self action:@selector(shuzi:) forControlEvents:UIControlEventTouchUpInside]; //按下按钮,并且当手指离开离开屏幕的时候触发这个事件
//触发了这个事件后,执行shuzi方法,action:@selector(shuzi:)
[self.view addSubview:button0]; //显示控件 //添加运算符
NSArray *array1=[NSArray arrayWithObjects:@"+",@"-",@"*",@"/",nil];
for (int i=0; i<4; i++)
{
UIButton *button1=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button1 setFrame:CGRectMake(225, 150+65*i, 60, 60)];
[button1 setTitle:[array1 objectAtIndex:i] forState:UIControlStateNormal];
//[array1 objectAtIndex:i]为获取按钮的属性值
[self.view addSubview:button1];
[button1 addTarget:self action:@selector(go:) forControlEvents:UIControlEventTouchUpInside];
} //添加=
UIButton *button2=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button2 setFrame:CGRectMake(160, 410, 125, 35)];
[button2 setTitle:@"=" forState:UIControlStateNormal];
[button2 addTarget:self action:@selector(go:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button2]; //添加清除键
UIButton *button3=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button3 setFrame:CGRectMake(30, 410, 125, 35)];
[button3 setTitle:@"AC" forState:UIControlStateNormal];
[button3 addTarget:self action:@selector(clean:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button3]; //添加.
UIButton *button4=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button4 setFrame:CGRectMake(95, 345, 60, 60)];
[button4 setTitle:@"." forState:UIControlStateNormal];
[button4 addTarget:self action:@selector(shuzi:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button4]; //后退
UIButton *button5=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button5 setFrame:CGRectMake(160, 345, 60, 60)];
[button5 setTitle:@"back" forState:UIControlStateNormal];
[button5 addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button5]; self.string=[[NSMutableString alloc]init];//初始化可变字符串,分配内存
self.str = [[NSString alloc]init];
// Do any additional setup after loading the view, typically from a nib.
} //0-9方法
- (void)shuzi:(id)sender
{ [self.string appendString:[sender currentTitle]]; //数字连续输入
self.label.text=[NSString stringWithString:_string]; //显示数值
self.num1=[self.label.text doubleValue]; //保存输入的数值
NSLog(@"self.num1 is %f",self.num1); } //计算方法
-(void)go:(id)sender
{
if ([self.str isEqualToString:@""])//当str里为空
{
self.num2=self.num1;
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithString:_string]; //只要是符号就显示数值
[self.string setString:@""]; //字符串清零
self.str=[sender currentTitle]; //保存运算符为了作判断作何种运算
NSLog(@"%@",_str);
[self.string appendString:self.str];
self.label.text=[NSString stringWithString:_string]; //显示数值
[self.string setString:@""]; //字符串清零
}
else
{
//输出上次计算结果
if ([self.str isEqualToString:@"+"])//之前的符号是+
{
[self.string setString:@""];//字符串清零
self.num2+=self.num1;//num2是运算符号左边的数值,还是计算结果 //输出上次结果后判断这次输入的是何符号
if ([[sender currentTitle]isEqualToString:@"="])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
self.str=@"";
}
else if ([[sender currentTitle]isEqualToString:@"+"]||[[sender currentTitle]isEqualToString:@"-"]||[[sender currentTitle]isEqualToString:@"*"]||[[sender currentTitle]isEqualToString:@"/"])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
[self.string setString:@""]; //字符串清零
self.str=[sender currentTitle];//保存运算符为了作判断作何种运算
NSLog(@"%@",_str);
[self.string appendString:self.str];
[self.string setString:@""];//字符串清零
}
} else if ([self.str isEqualToString:@"-"])//之前的符号是-
{
[self.string setString:@""];//字符串清零
self.num2-=self.num1;
//输出上次结果后判断这次输入的是何符号
if ([[sender currentTitle]isEqualToString:@"="])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
self.str=@"";
}
else if ([[sender currentTitle]isEqualToString:@"+"]||[[sender currentTitle]isEqualToString:@"-"]||[[sender currentTitle]isEqualToString:@"*"]||[[sender currentTitle]isEqualToString:@"/"])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
[self.string setString:@""];//字符串清零
self.str=[sender currentTitle];//保存运算符为了作判断作何种运算
NSLog(@"%@",_str);
[self.string appendString:self.str];
[self.string setString:@""];//字符串清零
}
} else if([self.str hasPrefix:@"*"])//之前的符号是* hasPrefix:方法的功能是判断创建的字符串内容是否以某个字符开始
{
[self.string setString:@""];//字符串清零
self.num2*=self.num1;
//输出上次结果后判断这次输入的是何符号
if ([[sender currentTitle] isEqualToString:@"="])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
self.str=@"";
}
else if ([[sender currentTitle]isEqualToString:@"+"]||[[sender currentTitle]isEqualToString:@"-"]||[[sender currentTitle]isEqualToString:@"*"]||[[sender currentTitle]isEqualToString:@"/"])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
[self.string setString:@""]; //字符串清零
self.str=[sender currentTitle]; //保存运算符为了作判断作何种运算
NSLog(@"%@",_str);
[self.string appendString:self.str]; //在字符串后增加新的东西,[a appendString:]
[self.string setString:@""]; //字符串清零
}
} else if ([self.str isEqualToString:@"/"])//之前的符号是/
{
[self.string setString:@""];//字符串清零
self.num2/=self.num1;
//判断输出上次结果后判断这次输入的是何符号
if ([[sender currentTitle]isEqualToString:@"="])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
self.str=@"";
}
else if ([[sender currentTitle]isEqualToString:@"+"]||[[sender currentTitle]isEqualToString:@"-"]||[[sender currentTitle]isEqualToString:@"*"]||[[sender currentTitle]isEqualToString:@"/"])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
[self.string setString:@""];//字符串清零
self.str=[sender currentTitle];//保存运算符为了作判断作何种运算
NSLog(@"%@",_str);
[self.string appendString:self.str];
[self.string setString:@""];//字符串清零
} }
}
} //当按下清除建时,所有数据清零
-(void)clean:(id)sender
{
[self.string setString:@""];//清空字符
self.num1=0;
self.num2=0;
self.label.text=@"0";//保证下次输入时清零 } //返回键
-(void)back:(id)sender
{
if (![self.label.text isEqualToString:@""])//判断不是空
{
[self.string deleteCharactersInRange:NSMakeRange
([self.string length]-1,1)];//删除最后一个字符
self.label.text=[NSString stringWithString:_string];//显示结果
}
} - (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end

---恢复内容结束---

步骤:

1.打开Xcode,单机Creat a new Xcode project

2.左边选择ios下Application,右边选择single view Application

3.填写项目名称单机Next

4.ViewController.h中定义成员和方法

//
// ViewController.h
// TestCalculator4
//
// Created by heyonggang on 13-11-28.
// Copyright (c) 2013年 MiracleHe. All rights reserved.
// #import <UIKit/UIKit.h> @interface ViewController : UIViewController @property(retain,nonatomic) UIButton *button;
@property(retain,nonatomic) UILabel *label;
@property(retain,nonatomic) NSMutableString *string; //NSMutableString用来处理可变对象,如需要处理字符串并更改字符串中的字符
@property(assign,nonatomic) double num1,num2;
@property(assign,nonatomic) NSString *str; @end

5.ViewController.m

//
// ViewController.m
// TestCalculator4
//
// Created by heyonggang on 13-11-28.
// Copyright (c) 2013年 MiracleHe. All rights reserved.
// #import "ViewController.h"
#import <QuartzCore/QuartzCore.h> @interface ViewController () @end @implementation ViewController - (void)viewDidLoad
{
[super viewDidLoad]; //创建标签
self.label=[[UILabel alloc]initWithFrame:CGRectMake(90, 40, 200, 50)];
[self.view addSubview:_label];
self.label.backgroundColor=[UIColor greenColor]; //设置背景颜色
self.label.textColor=[UIColor blackColor]; //字体颜色
//self.label.textAlignment = UITextAlignmentRight; //字体居右
self.label.textAlignment = NSTextAlignmentCenter;
self.label.font=[UIFont systemFontOfSize:32.4]; //设置字体 //添加1-9数字
NSArray *array=[NSArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9", nil];
int n=0;
for (int i=0; i<3; i++)
{
for (int j=0; j<3; j++)
{
self.button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
self.button.frame=CGRectMake(30+65*j, 150+65*i, 60, 60);
[self.button setTitle:[array objectAtIndex:n++] forState:UIControlStateNormal]; //注意:[array objectAtIndex:n++]
[self.view addSubview:_button];
[self.button addTarget:self action:@selector(shuzi:) forControlEvents:UIControlEventTouchUpInside]; //addTarget:self 的意思是说,这个方法在本类中也可以传入其他类的指针
}
} //单独添加0
UIButton *button0=[UIButton buttonWithType:UIButtonTypeCustom]; //创建一个圆角矩形的按钮
/*
CALayer *layer = button0.layer;
[layer setMasksToBounds:YES];
[layer setCornerRadius:5.0];
button0.layer.borderColor = [UIColor lightGrayColor].CGColor;
button0.layer.borderWidth = 1.0f;
*/
[button0 setFrame:CGRectMake(30, 345, 60, 60)]; //设置button在view上的位置
//也可以这样用:button0.frame:CGRectMake(30, 345, 60, 60);
[button0 setTitle:@"0" forState:UIControlStateNormal]; //设置button主题
button0.titleLabel.textColor = [UIColor blackColor]; //设置0键的颜色
[button0 addTarget:self action:@selector(shuzi:) forControlEvents:UIControlEventTouchUpInside]; //按下按钮,并且当手指离开离开屏幕的时候触发这个事件
//触发了这个事件后,执行shuzi方法,action:@selector(shuzi:)
[self.view addSubview:button0]; //显示控件 //添加运算符
NSArray *array1=[NSArray arrayWithObjects:@"+",@"-",@"*",@"/",nil];
for (int i=0; i<4; i++)
{
UIButton *button1=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button1 setFrame:CGRectMake(225, 150+65*i, 60, 60)];
[button1 setTitle:[array1 objectAtIndex:i] forState:UIControlStateNormal];
//[array1 objectAtIndex:i]为获取按钮的属性值
[self.view addSubview:button1];
[button1 addTarget:self action:@selector(go:) forControlEvents:UIControlEventTouchUpInside];
} //添加=
UIButton *button2=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button2 setFrame:CGRectMake(160, 410, 125, 35)];
[button2 setTitle:@"=" forState:UIControlStateNormal];
[button2 addTarget:self action:@selector(go:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button2]; //添加清除键
UIButton *button3=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button3 setFrame:CGRectMake(30, 410, 125, 35)];
[button3 setTitle:@"AC" forState:UIControlStateNormal];
[button3 addTarget:self action:@selector(clean:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button3]; //添加.
UIButton *button4=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button4 setFrame:CGRectMake(95, 345, 60, 60)];
[button4 setTitle:@"." forState:UIControlStateNormal];
[button4 addTarget:self action:@selector(shuzi:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button4]; //后退
UIButton *button5=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[button5 setFrame:CGRectMake(160, 345, 60, 60)];
[button5 setTitle:@"back" forState:UIControlStateNormal];
[button5 addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button5]; self.string=[[NSMutableString alloc]init];//初始化可变字符串,分配内存
self.str = [[NSString alloc]init];
// Do any additional setup after loading the view, typically from a nib.
} //0-9方法
- (void)shuzi:(id)sender
{ [self.string appendString:[sender currentTitle]]; //数字连续输入
self.label.text=[NSString stringWithString:_string]; //显示数值
self.num1=[self.label.text doubleValue]; //保存输入的数值
NSLog(@"self.num1 is %f",self.num1); } //计算方法
-(void)go:(id)sender
{
if ([self.str isEqualToString:@""])//当str里为空
{
self.num2=self.num1;
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithString:_string]; //只要是符号就显示数值
[self.string setString:@""]; //字符串清零
self.str=[sender currentTitle]; //保存运算符为了作判断作何种运算
NSLog(@"%@",_str);
[self.string appendString:self.str];
self.label.text=[NSString stringWithString:_string]; //显示数值
[self.string setString:@""]; //字符串清零
}
else
{
//输出上次计算结果
if ([self.str isEqualToString:@"+"])//之前的符号是+
{
[self.string setString:@""];//字符串清零
self.num2+=self.num1;//num2是运算符号左边的数值,还是计算结果 //输出上次结果后判断这次输入的是何符号
if ([[sender currentTitle]isEqualToString:@"="])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
self.str=@"";
}
else if ([[sender currentTitle]isEqualToString:@"+"]||[[sender currentTitle]isEqualToString:@"-"]||[[sender currentTitle]isEqualToString:@"*"]||[[sender currentTitle]isEqualToString:@"/"])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
[self.string setString:@""]; //字符串清零
self.str=[sender currentTitle];//保存运算符为了作判断作何种运算
NSLog(@"%@",_str);
[self.string appendString:self.str];
[self.string setString:@""];//字符串清零
}
} else if ([self.str isEqualToString:@"-"])//之前的符号是-
{
[self.string setString:@""];//字符串清零
self.num2-=self.num1;
//输出上次结果后判断这次输入的是何符号
if ([[sender currentTitle]isEqualToString:@"="])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
self.str=@"";
}
else if ([[sender currentTitle]isEqualToString:@"+"]||[[sender currentTitle]isEqualToString:@"-"]||[[sender currentTitle]isEqualToString:@"*"]||[[sender currentTitle]isEqualToString:@"/"])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
[self.string setString:@""];//字符串清零
self.str=[sender currentTitle];//保存运算符为了作判断作何种运算
NSLog(@"%@",_str);
[self.string appendString:self.str];
[self.string setString:@""];//字符串清零
}
} else if([self.str hasPrefix:@"*"])//之前的符号是* hasPrefix:方法的功能是判断创建的字符串内容是否以某个字符开始
{
[self.string setString:@""];//字符串清零
self.num2*=self.num1;
//输出上次结果后判断这次输入的是何符号
if ([[sender currentTitle] isEqualToString:@"="])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
self.str=@"";
}
else if ([[sender currentTitle]isEqualToString:@"+"]||[[sender currentTitle]isEqualToString:@"-"]||[[sender currentTitle]isEqualToString:@"*"]||[[sender currentTitle]isEqualToString:@"/"])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
[self.string setString:@""]; //字符串清零
self.str=[sender currentTitle]; //保存运算符为了作判断作何种运算
NSLog(@"%@",_str);
[self.string appendString:self.str]; //在字符串后增加新的东西,[a appendString:]
[self.string setString:@""]; //字符串清零
}
} else if ([self.str isEqualToString:@"/"])//之前的符号是/
{
[self.string setString:@""];//字符串清零
self.num2/=self.num1;
//判断输出上次结果后判断这次输入的是何符号
if ([[sender currentTitle]isEqualToString:@"="])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
self.str=@"";
}
else if ([[sender currentTitle]isEqualToString:@"+"]||[[sender currentTitle]isEqualToString:@"-"]||[[sender currentTitle]isEqualToString:@"*"]||[[sender currentTitle]isEqualToString:@"/"])
{
NSLog(@"self.num2 is %f",self.num2);
self.label.text=[NSString stringWithFormat:@"%f",self.num2];
[self.string setString:@""];//字符串清零
self.str=[sender currentTitle];//保存运算符为了作判断作何种运算
NSLog(@"%@",_str);
[self.string appendString:self.str];
[self.string setString:@""];//字符串清零
} }
}
} //当按下清除建时,所有数据清零
-(void)clean:(id)sender
{
[self.string setString:@""];//清空字符
self.num1=0;
self.num2=0;
self.label.text=@"0";//保证下次输入时清零 } //返回键
-(void)back:(id)sender
{
if (![self.label.text isEqualToString:@""])//判断不是空
{
[self.string deleteCharactersInRange:NSMakeRange
([self.string length]-1,1)];//删除最后一个字符
self.label.text=[NSString stringWithString:_string];//显示结果
}
} - (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} - (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end

IOS做一个简单计算器的更多相关文章

  1. 【Bugly干货分享】一起用 HTML5 Canvas 做一个简单又骚气的粒子引擎

    Bugly 技术干货系列内容主要涉及移动开发方向,是由Bugly邀请腾讯内部各位技术大咖,通过日常工作经验的总结以及感悟撰写而成,内容均属原创,转载请标明出处. 前言 好吧,说是“粒子引擎”还是大言不 ...

  2. MUI框架-05-用MUI做一个简单App

    MUI框架-05-用MUI做一个简单App MUI 是一个前端框架,前端框架就像 Bootstrap,EasyUI,Vue ,为了做 app 呢,就有了更加高效的 MUI,我觉得前端框架有很多,也没有 ...

  3. 基于MFC的一个简单计算器

    写一个简单的计算器并不是什么很难的事,主要目的是要通过这个程序来学习和分析其中的核心算法.这个简易计算器的核心部分就是对输入的表达式的正确性判断与求值,其中包括对表达式的解析.中缀表达式转后缀表达式. ...

  4. 使用React并做一个简单的to-do-list

    1. 前言 说到React,我从一年之前就开始试着了解并且看了相关的入门教程,而且还买过一本<React:引领未来的用户界面开发框架 >拜读.React的轻量组件化的思想及其virtual ...

  5. 【 D3.js 入门系列 --- 3 】 做一个简单的图表!

    前面说了几节,都是对文字进行处理,这一节中将用 D3.js 做一个简单的柱形图. 做柱形图有很多种方法,比如用 HTML 的 div 标签,或用 svg . 推荐用 SVG 来做各种图形.SVG 意为 ...

  6. 一起用HTML5 canvas做一个简单又骚气的粒子引擎

    前言 好吧,说是"粒子引擎"还是大言不惭而标题党了,离真正的粒子引擎还有点远.废话少说,先看demo 本文将教会你做一个简单的canvas粒子制造器(下称引擎). 世界观 这个简单 ...

  7. Jmeter初步使用二--使用jmeter做一个简单的性能测试

    经过上一次的初步使用,我们懂得了Jmeter的安装与初步使用的方法.现在,我们使用Jmeter做一个简单的性能测试.该次测试,提交的参数不做参数化处理,Jmeter各元件使用将在介绍在下一博文开始介绍 ...

  8. 用EF DataBase First做一个简单的MVC3报名页面

    使用EF DataBase First做一个简单的MVC3报名网站 ORM(Object Relational Mapping)是面向对象语言中的一种数据访问技术,在ASP.NET中,可以通过ADO. ...

  9. 【 D3.js 入门系列 — 3 】 做一个简单的图表!

    图1. 柱形图 1. 柱形图 前几章的例子,都是对文字进行处理.本章中将用 D3 做一个简单的柱形图.制作柱形图有很多种方法,比如用 HTML 的 <div> 标签,或在 SVG 上绘制 ...

随机推荐

  1. 更换VS2012序列号的方法

    转自:http://blog.sina.com.cn/s/blog_58c506600101ja49.html 今天不小心把还在试用期内的VS2012 Ultimate填上盗版Key激活了……找遍了菜 ...

  2. Jquery实现页面上所有的checkbox只能选中一个

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <hea ...

  3. mysql数据类型区别

    create table t1(c1 float(10,2), c3 decimal(10,2)); insert into t1 values(1234567.23, 1234567.23,1234 ...

  4. Java_Hbase优化

    1.datanode的最大文件数 vi $HADOOP_HOME/conf/hdfs-site.xml <property> <name>dfs.datanode.max.xc ...

  5. 用komodo建立python开发环境

    配置 在菜单中选择Edit.Preferences. 代码自动完成 更改tab代表的空格数 括号自动关闭和语法检查 interactive shell 中文支持 缩写 点击菜单View.Tabs &a ...

  6. iOS网络监测如何区分2、3、4G?

    你可以在Github下载这个Demo 首先,引入系统的Reachability类,不知道怎么引入的话,在Xcode,按下shift+command+0,搜索Reachability,看到图中所选的工程 ...

  7. C# 程序集反射

    namespace AssemblyLibrary { public class AssemblyLibrary { public static object LoadAssembly(string ...

  8. Asp.Net 之 MasterPage

    母版页是VS2005中新引入的一个概念,它很好地实现界面设计的模块化,并且实现实现了代码的重用.它就像婚纱影楼中的婚纱模板,同一个婚纱模板可以给不同的新人用,只要把他们的照片贴在已有的婚纱模板就可以形 ...

  9. CSDN中根据文章自动生成文章目录

    概述 CSDN中有根据文件内容中H标签在文章中自动生成文章目录,看起来比较专业,就想把它搬到自己的博客园中.类似下图 提取JS脚本 通过浏览器开发者工具(IE/Chrome)找到产生文章目录javas ...

  10. Android小项目之七 应用程序的更新安装

    ------- 源自梦想.永远是你IT事业的好友.只是勇敢地说出我学到! ---------- 按惯例,写在前面的:可能在学习Android的过程中,大家会和我一样,学习过大量的基础知识,很多的知识点 ...