其實(shí)就是想知道怎么開發(fā)ios的app吧?
成都創(chuàng)新互聯(lián)公司是一家專注于成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)與策劃設(shè)計(jì),郟縣網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設(shè)十年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:郟縣等地區(qū)。郟縣做網(wǎng)站價(jià)格咨詢:13518219792
首先, 不要倔強(qiáng), 你需要付出99$購買開發(fā)者賬號, 需要一臺(tái)測試用的iphone/ipad, 最好有一臺(tái)mac電腦.
然后, 你會(huì)購買賬號之后, 那個(gè)買賬號的網(wǎng)站會(huì)把這些問題的答案全部告訴你.
最后, 你問題比較多, 就不詳細(xì)描述了, 有耐心的話, 那個(gè)網(wǎng)站會(huì)把所有的告訴你
首先我們要打開手機(jī),然后從iPhone手機(jī)的底部向上滑動(dòng),調(diào)出“控制中心”頁面,然后點(diǎn)擊右上方的“轉(zhuǎn)屏”按鈕,關(guān)閉“豎排方向鎖定”。
iPhone手機(jī)調(diào)用科學(xué)計(jì)算器
第二步:這時(shí)我們的手機(jī)就可以橫豎自由旋轉(zhuǎn)了,接下來在“附加程序”中找到“計(jì)算器”并打開,這時(shí)我們看到的還是簡單的計(jì)算器。
iPhone手機(jī)調(diào)用科學(xué)計(jì)算器
第三步:之后我們只要旋轉(zhuǎn)手機(jī),讓手機(jī)由豎向轉(zhuǎn)為橫向,計(jì)算器就可以變?yōu)椤翱茖W(xué)計(jì)算器”的界面了,這時(shí)用戶就可以算那些復(fù)雜的數(shù)據(jù)了。
iPhone手機(jī)調(diào)用科學(xué)計(jì)算器
這是因?yàn)槟愕膙iewcontroller 繼承了UIViewController.而UIViewController 繼承自oc的NSObject. 在swift 中被修飾成@objc class. 那么就必須要遵循oc的selector,在oc中是不支持方法重載的。所以會(huì)報(bào)上面的錯(cuò)誤
如果要解決這種問題有兩種方法
1. 刪除繼承自oc的類
2. 其中一個(gè)方法重命名
你的這種情況,顯然第一種方法不合適,你的控制器還是需要繼承自uiviewcontroller,那么只能用第二種方法,對這個(gè)方法進(jìn)行重命名。
參考:
#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:@" 計(jì)算器"];
[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
在 XCode 里面,點(diǎn) Show the Breakpoint navigator 按鈕,在左下角有一個(gè)加號,點(diǎn)加號,然后點(diǎn) Add Exception Breakpoint 和 Add Swift Error Breakpoint。然后重新編譯執(zhí)行項(xiàng)目,貼報(bào)錯(cuò)上來。
網(wǎng)站欄目:ios開發(fā)計(jì)算器,ios計(jì)算器計(jì)算過程
文章出自:http://aaarwkj.com/article8/dssjjip.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁設(shè)計(jì)公司、標(biāo)簽優(yōu)化、營銷型網(wǎng)站建設(shè)、外貿(mào)建站、App開發(fā)、全網(wǎng)營銷推廣
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)