ios开发计算器,ios计算器计算过程

ios 开发一个计算器需要用到那些步骤?

其实就是想知道怎么开发ios的app吧?

成都创新互联公司是一家专注于成都网站设计、成都网站建设与策划设计,郏县网站建设哪家好?成都创新互联公司做网站,专注于网站建设十年,网设计领域的专业建站公司;建站业务涵盖:郏县等地区。郏县做网站价格咨询:13518219792

首先, 不要倔强, 你需要付出99$购买开发者账号, 需要一台测试用的iphone/ipad, 最好有一台mac电脑.

然后, 你会购买账号之后, 那个买账号的网站会把这些问题的答案全部告诉你.

最后, 你问题比较多, 就不详细描述了, 有耐心的话, 那个网站会把所有的告诉你

ios 超级计算器 怎么实现的

首先我们要打开手机,然后从iPhone手机的底部向上滑动,调出“控制中心”页面,然后点击右上方的“转屏”按钮,关闭“竖排方向锁定”。

iPhone手机调用科学计算器

第二步:这时我们的手机就可以横竖自由旋转了,接下来在“附加程序”中找到“计算器”并打开,这时我们看到的还是简单的计算器。

iPhone手机调用科学计算器

第三步:之后我们只要旋转手机,让手机由竖向转为横向,计算器就可以变为“科学计算器”的界面了,这时用户就可以算那些复杂的数据了。

iPhone手机调用科学计算器

斯坦福iOS8开发计算器的一个代码问题

这是因为你的viewcontroller 继承了UIViewController.而UIViewController 继承自oc的NSObject. 在swift 中被修饰成@objc class. 那么就必须要遵循oc的selector,在oc中是不支持方法重载的。所以会报上面的错误

如果要解决这种问题有两种方法

1. 删除继承自oc的类

2. 其中一个方法重命名

你的这种情况,显然第一种方法不合适,你的控制器还是需要继承自uiviewcontroller,那么只能用第二种方法,对这个方法进行重命名。

参考:

ios 系统用Objective-C 在sdk上开发一个小型计算器,要求实现基本的四则运算即可,带源码和分析

#import UIKit/UIKit.h

@interface LEViewController : UIViewController

{

double a;

double b;

double c;

UITextField *atextField;

UILabel *aLabel;

NSString *str;

NSMutableString *str1;

}

@end

#import "LEViewController.h"

@interface LEViewController ()

@end

@implementation LEViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self) {

str1=[[NSMutableString alloc]init ];}

return self;

}

/**

*@控制器入口

*

*/

- (void)viewDidLoad

{

[super viewDidLoad];

// Do any additional setup after loading the view.

[self.view setBackgroundColor:[UIColor blueColor] ];

aLabel= [[UILabel alloc]initWithFrame:CGRectMake(100, 20, 80, 40)];

[aLabel setText:@" 计算器"];

[self.view addSubview:aLabel];

atextField =[[UITextField alloc]initWithFrame:CGRectMake(0, 60, 320, 50)];

[atextField setBorderStyle:UITextBorderStyleRoundedRect];

[self.view addSubview:atextField];

UIButton *button=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button setFrame:CGRectMake(20, 380, 270, 60)];

[button setTitle:@"=" forState:UIControlStateNormal];

[button addTarget:self action:@selector(go) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button];

UIButton *button1=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button1 setFrame:CGRectMake(20, 110, 60, 60)];

[button1 setTitle:@"1" forState:UIControlStateNormal];

[button1 addTarget:self action:@selector(one) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button1];

UIButton *button2=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button2 setFrame:CGRectMake(90, 110, 60, 60)];

[button2 setTitle:@"2" forState:UIControlStateNormal];

[button2 addTarget:self action:@selector(two) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button2];

UIButton *button3=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button3 setFrame:CGRectMake(160, 110, 60, 60)];

[button3 setTitle:@"3" forState:UIControlStateNormal];

[button3 addTarget:self action:@selector(three) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button3];

UIButton *button4=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button4 setFrame:CGRectMake(20, 170, 60, 60)];

[button4 setTitle:@"4" forState:UIControlStateNormal];

[button4 addTarget:self action:@selector(four) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button4];

UIButton *button5=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button5 setFrame:CGRectMake(90, 170, 60, 60)];

[button5 setTitle:@"5" forState:UIControlStateNormal];

[button5 addTarget:self action:@selector(five) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button5];

UIButton *button6=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button6 setFrame:CGRectMake(160, 170, 60, 60)];

[button6 setTitle:@"6" forState:UIControlStateNormal];

[button6 addTarget:self action:@selector(six) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button6];

UIButton *button7=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button7 setFrame:CGRectMake(20, 240, 60, 60)];

[button7 setTitle:@"7" forState:UIControlStateNormal];

[button7 addTarget:self action:@selector(seven) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button7];

UIButton *button8=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button8 setFrame:CGRectMake(90, 240, 60, 60)];

[button8 setTitle:@"8" forState:UIControlStateNormal];

[button8 addTarget:self action:@selector(eight) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button8];

UIButton *button9=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button9 setFrame:CGRectMake(160, 240, 60, 60)];

[button9 setTitle:@"9" forState:UIControlStateNormal];

[button9 addTarget:self action:@selector(nine) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button9];

UIButton *button10=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button10 setFrame:CGRectMake(20, 310, 60, 60)];

[button10 setTitle:@"0" forState:UIControlStateNormal];

[button10 addTarget:self action:@selector(zero) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button10];

UIButton *button11=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button11 setFrame:CGRectMake(90, 310, 60, 60)];

[button11 setTitle:@"." forState:UIControlStateNormal];

[button11 addTarget:self action:@selector(dian) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button11];

UIButton *button12=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button12 setFrame:CGRectMake(230, 240, 60, 60)];

[button12 setTitle:@"*" forState:UIControlStateNormal];

[button12 addTarget:self action:@selector(chen) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button12];

UIButton *button13=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button13 setFrame:CGRectMake(160, 310, 60, 60)];

[button13 setTitle:@"AC" forState:UIControlStateNormal];

[button13 addTarget:self action:@selector(ac) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button13];

UIButton *button14=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button14 setFrame:CGRectMake(230, 310, 60, 60)];

[button14 setTitle:@"/" forState:UIControlStateNormal];

[button14 addTarget:self action:@selector(chu) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button14];

UIButton *button15=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button15 setFrame:CGRectMake(230, 110, 60, 60)];

[button15 setTitle:@"+" forState:UIControlStateNormal];

[button15 addTarget:self action:@selector(add) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button15];

UIButton *button16=[UIButton buttonWithType:UIButtonTypeRoundedRect];

[button16 setFrame:CGRectMake(230, 170, 60, 60)];

[button16 setTitle:@"-" forState:UIControlStateNormal];

[button16 addTarget:self action:@selector(jian) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:button16];

}

-(void)one

{

str =@"1";

[str1 appendString:str];

atextField.text=str1;

a=[str1 doubleValue];

}

-(void)two

{

str =@"2";

[str1 appendString:str];

atextField.text=str1;

a=[str1 doubleValue];

}

-(void)three

{

str =@"3";

[str1 appendString:str];

atextField.text=str1;

a=[str1 doubleValue];

}

-(void)four

{

str =@"4";

[str1 appendString:str];

atextField.text=str1;

a=[str1 doubleValue];}

-(void)five

{

str =@"5";

[str1 appendString:str];

atextField.text=str1;

a=[str1 doubleValue];}

-(void)six

{

str =@"6";

[str1 appendString:str];

atextField.text=str1;

a=[str1 doubleValue];}

-(void)seven

{

str =@"7";

[str1 appendString:str];

atextField.text=str1;

a=[str1 doubleValue];}

-(void)eight

{

str =@"8";

[str1 appendString:str];

atextField.text=str1;

a=[str1 doubleValue];}

-(void)nine

{

str =@"9";

[str1 appendString:str];

atextField.text=str1;

a=[str1 doubleValue];}

-(void)add

{

str =@"+";

[str1 appendString:str];

atextField.text=str1;

b='1';c=a;

a=[str1 doubleValue];

[str1 release];

str1=[[NSMutableString alloc] init];}

-(void)jian

{

str =@"-";

[str1 appendString:str];

atextField.text=str1;

b='2';c=a;

a=[str1 doubleValue];

[str1 release];

str1=[[NSMutableString alloc] init];}

-(void)chen

{

str =@"*";

[str1 appendString:str];

atextField.text=str1;

b='3';c=a;

a=[str1 doubleValue];

[str1 release];

str1=[[NSMutableString alloc] init];}

-(void)chu

{

str =@"/";

[str1 appendString:str];

atextField.text=str1;

b='4';c=a;

a=[str1 doubleValue];

[str1 release];

str1=[[NSMutableString alloc] init];}

-(void)dian

{

str =@".";

[str1 appendString:str];

atextField.text=str1;

a=[str1 doubleValue];}

-(void)ac

{

str =@"0";

atextField.text=@"0";}

-(void)zero

{

str =@"0";

[str1 appendString:str];

atextField.text=str1;}

-(void)go

{if (b=='1') {br/p atextField.text=[NSString stringWithFormat:@"%f",(a+c)];}

if (b=='2') {

atextField.text=[NSString stringWithFormat:@"%f",(c-a)];}

if (b=='3') {

atextField.text=[NSString stringWithFormat:@"%f",(a*c)];}

if (b=='4') {

atextField.text=[NSString stringWithFormat:@"%f",(a/c)];}

if (b=='5') {

atextField.text=[NSString stringWithFormat:@"0"];}

[str1 release];

str1=[[NSMutableString alloc] init];}

- (void)didReceiveMemoryWarning

{

[super didReceiveMemoryWarning];

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

{return (interfaceOrientation == UIInterfaceOrientationPortrait);}

@end

本人初学iOS开发,跟着Stanford的公开课用Swift做一个计算器,出现Thread 1: signal SIGABRT错误

在 XCode 里面,点 Show the Breakpoint navigator 按钮,在左下角有一个加号,点加号,然后点 Add Exception Breakpoint 和 Add Swift Error Breakpoint。然后重新编译执行项目,贴报错上来。


文章标题:ios开发计算器,ios计算器计算过程
当前网址:http://azwzsj.com/article/dssjjip.html