[某鷗實訓記][objective-c][第一天][個人筆記]

來源:互聯網
上載者:User

標籤:

UIView,UILabel,UITextField,ViewController.....

然而上面這些都並沒太搞懂......

下面是學到的東西=w=

//一邊百度一邊學的..所以很多東西都來自別的blog..後邊會貼出出處

 

.frame :控制項相對於父視圖的位置

 

UITextField.borderStyle :UITextField的樣式

 

.text :控制項顯示的文本

 

.backgroundColor :控制項的背景顏色(然而設定了這個會讓控制項的某些屬性無效)

 

UIColor :一個顏色的類...然而我並沒有看懂

//http://www.cnblogs.com/smileEvday/archive/2012/06/05/UIColor_CIColor_CGColor.html

 

- addSubview:(UIView *) :向視圖中添加子視圖

 

 CGRectMake(<CGFloat x>, <CGFloat y>, <CGFloat width>, <CGFloat height>) :參數相對於父視圖的x,y位移和dx,dy.返回一個CGRect值.

//http://blog.csdn.net/chengyingzhilian/article/details/7894276

 

addTarget:<(id)> action:<(SEL)> forControlEvents:<(UIControlEvents)> :執行動作的目標,執行動作的函數,和在什麼時候執行動作

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

 

↑↑↑↑這是例子,在這個ViewController(self)中,執行back:這個函數,在按下而且在空間範圍內彈起是響應

//這裡有各種事件的說明http://blog.csdn.net/g5dsk/article/details/6613943

 

resignFirstResponder :這個可以用在UITextField上來釋放第一響應....能收回鍵盤

 

UIBarButton :可以添加到navigationItem上的按鈕

 

pushViewController:<(UIViewController *)> animated:<(BOOL)> :推出一個ViewController 可以用來切換頁面,animated用來控制有沒有推齣動畫

popToRootViewControllerAnimated:<(BOOL)>:返回調用它的視圖控制器.同樣可以選擇有沒有動畫

 

/*上邊就是我挑選出來的這一天學到的....下面是一些沒有整理過的範例程式碼*/

 

 

    UIView *view = [[UIView alloc]init];    view.frame = CGRectMake(0, 0, 100, 100);    view.backgroundColor = [UIColor yellowColor];    [self.view addSubview:view];

    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];    button.frame = CGRectMake(100, 100, 100, 100);    button.backgroundColor = [UIColor blueColor];    [button addTarget:self action:@selector(push) forControlEvents:UIControlEventTouchUpInside];    [self.view addSubview:button]
-(void)push{    FirstViewController *first = [[FirstViewController alloc] init];    [self.navigationController pushViewController:first animated:YES];}

 

[某鷗實訓記][objective-c][第一天][個人筆記]

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.