中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

iphone學習

發布時間:2020-03-21 06:24:51 來源:網絡 閱讀:352 作者:easytoold 欄目:開發技術

//2013年11月28 學習iphone界面編程由于本人是一個iphone開發新人很多時候是邊看別人的代碼然后在測驗代碼的功能但還有些功能沒有測試很多地方不懂如果大神經過不妨幫忙指點。如果有大神做過計算器全代碼——不用拖界面求給我一個源碼我將不勝感激//


#import "ViewController.h"


@interface ViewController ()


@end


@implementation ViewController


- (void)buttonPressed:(int)sender{

   UIAlertView *alert = [[UIAlertViewalloc]initWithTitle:@"事件是"

                                                 message:@"%i"

                                                delegate:nil

                                       cancelButtonTitle:@"是的"

                                       otherButtonTitles:nil];

   

   [alertshow];

}



- (void)viewDidLoad

{

   [superloadView];

   //界面的背景色設置

   /*UIView定義了屏幕上的一個矩形區域

    */

   UIView *contentView = [[UIViewalloc]initWithFrame: [[UIScreenmainScreen]applicationFrame]];

   //設置容器的背景色UIColor對象可以定義當前的顏色或者你可以存儲顏色值以便以后使用。他也可以改變容器的alpha值。

   contentView.backgroundColor = [UIColorgroupTableViewBackgroundColor];

   //當前對象即為當前窗口

  self.view = contentView;

   //[contentView release];

   

   //label

   //UILabel可定義一個只讀的文本框。CGRectMake(x,y,width,height):xy是標簽相對位置。widthheight是標簽的長和高。

  UILabel * label = [[UILabelalloc]initWithFrame:CGRectMake(50.0,30.0,200,30)];

   //設置標簽的內容

   label.text =@"你好";

   //標簽位于contentView的中心

   //label.center = contentView.center;

   //設置標簽的顏色

   label.backgroundColor = [UIColorgreenColor];

   label.textAlignment =UITextAutocapitalizationTypeAllCharacters;

   //將標簽添加到容器中去

   [self.viewaddSubview:label];

   //[label release];

 

   //button

   //buttonWithTypeUIButton的一個實例方法它可以動態的區創建一個不同風格的按鈕。

   UIButton *button1 = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   //CGRectMake(x,y,width,height):確定button的位置width和height確定button的大小

   [button1setFrame:CGRectMake(20.0,60.0,77, 37)];

   //setTitle可以設置button的標題。

   //forState和后面的參數不知道含義

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

   [button1 setTitle:@"ok"forState:UIControlStateDisabled];

   [button1addTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:button1];

   

   UIButton *button2 = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   [button2setFrame:CGRectMake(80.0,60.0,77, 37)];

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

   [button2 setTitle:@"ok"forState:UIControlStateDisabled];

   [button2addTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:button2];

   UIButton *button3 = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   [button3setFrame:CGRectMake(140.0,60.0,77,37)];

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

   [button3 setTitle:@"ok"forState:UIControlStateDisabled];

   [button3addTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:button3];

   

   UIButton *button4= [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   [button4setFrame:CGRectMake(200.0,60.0,77, 37)];

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

   [button4 setTitle:@"ok"forState:UIControlStateDisabled];

   [button4addTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:button4];

   

   UIButton *button5 = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   [button5setFrame:CGRectMake(20.0,100.0,77, 37)];

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

   [button5 setTitle:@"ok"forState:UIControlStateDisabled];

   [button5addTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:button5];

   

   UIButton *button6 = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   [button6setFrame:CGRectMake(80.0,100.0,77, 37)];

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

   [button6 setTitle:@"ok"forState:UIControlStateDisabled];

   [button6addTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:button6];

   

   UIButton *button7 = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   [button7setFrame:CGRectMake(140.0,100.0,77, 37)];

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

   [button7 setTitle:@"ok"forState:UIControlStateDisabled];

   [button7addTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:button7];

   

   UIButton *button8 = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   [button8setFrame:CGRectMake(200.0,100.0,77, 37)];

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

   [button8 setTitle:@"ok"forState:UIControlStateDisabled];

   [button8addTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:button8];


   UIButton *button9 = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   [button9setFrame:CGRectMake(20.0,140.0,77, 37)];

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

   [button9 setTitle:@"ok"forState:UIControlStateDisabled];

   [button9addTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:button9];

   

   UIButton *button0 = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   [button0setFrame:CGRectMake(80.0,100.0,77, 37)];

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

   [button0 setTitle:@"ok"forState:UIControlStateDisabled];

   [button0addTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:button0];

   

   UIButton *buttonAdd = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

   [buttonAddsetFrame:CGRectMake(80.0,140.0,77, 37)];

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

   [buttonAdd setTitle:@"ok"forState:UIControlStateDisabled];

   [buttonAddaddTarget:selfaction:@selector(buttonPressed:)forControlEvents:UIControlEventTouchDown];

   [self.viewaddSubview:buttonAdd];}



- (void)didReceiveMemoryWarning

{

   [superdidReceiveMemoryWarning];

 

}


@end

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

三原县| 潢川县| 南安市| 通河县| 东兴市| 诏安县| 涞水县| 达孜县| 都昌县| 特克斯县| 且末县| 芜湖市| 河北省| 独山县| 吉安市| 揭阳市| 金秀| 新野县| 驻马店市| 甘孜县| 汝南县| 洪湖市| 威海市| 孟津县| 隆化县| 藁城市| 神木县| 揭西县| 龙井市| 修水县| 井陉县| 商水县| 门源| 共和县| 蒙城县| 威海市| 包头市| 自治县| 招远市| 和田市| 榆树市|