標籤:
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][第一天][個人筆記]