_window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
_window.rootViewController = [[UIViewController alloc]init];
_window.rootViewController.view.userInteractionEnabled = NO;
//====================系統(tǒng)按鈕============================
UIButton *button1 = [[UIButton alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];
[_window addSubview:button1];
//設置文字及狀態(tài)
[button1 setTitle:@"sdd" forState:UIControlStateNormal];
//設置文字顏色及狀態(tài)
[button1 setTitleColor:[UIColor magentaColor] forState:UIControlStateNormal];
//設置圖片及狀態(tài)
[button1 setImage:[UIImage imageNamed:@"dasd"] forState:UIControlStateNormal];
//====================View的移動============================
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(100, 500, 100, 100)];
[_window addSubview:button1];
view.frame = CGRectMake(1, 1, 1, 1);
view.center = CGPointMake(1, 1);
view.bounds = CGRectMake(0, 0, 1, 1);
//旋轉
[view setTransform:CGAffineTransformMakeRotation(M_PI_2)];
//縮放
[view setTransform:CGAffineTransformMakeScale(1, 1)];
//平移
[view setTransform:CGAffineTransformMakeScale(-14, -12)];
//NSTimer scheduledTimerWithTimeInterval:<#(NSTimeInterval)#> target:<#(id)#> selector:<#(SEL)#> userInfo:<#(id)#> repeats:<#(BOOL)#>
//動畫
//UIView animateWithDuration:0.3 animations:^{
//}
//====================UIImageView============================
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(100, 500, 100, 100)];
//
imageView.image = [UIImage imageNamed:@"baoza1_1"];
[_window addSubview:imageView];
//================顯示幀動畫=================
//創(chuàng)建圖片數(shù)組
NSMutableArray *arrays = [[NSMutableArray alloc]init];
for (int i = 1; i <4; i++) {
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"dasd%d",i]];
[arrays addObject:image];
}
//設置動畫圖片數(shù)組(數(shù)組元素必須是UIImage對象)
[imageView setAnimationImages:arrays];
//設置播放完一組動畫所需要的時間(單位:秒)
[imageView setAnimationDuration:1];
//循環(huán)次數(shù)
[imageView setAnimationRepeatCount:5];
//開始動畫
[imageView startAnimating];
//停止動畫
[imageView stopAnimating];
_window.backgroundColor = [UIColor whiteColor];
[_window makeKeyAndVisible];
//================定時器=================
//1.定時器的創(chuàng)建
//參數(shù)1:時間間隔(定時的時間) 單位:秒
//參數(shù)2:響應消息的對象(調(diào)用方法的對象)
//參數(shù)3:消息(方法),可以帶參數(shù),但是只能帶一個參數(shù),而且參數(shù)的實參就是當前這個定時器對象本身
//參數(shù)4:需要傳入到定時器中的對象,一般是nil
//參數(shù)5:是否重復
//功能:repeats是NO -> 間隔1秒的時間后,[self time]; repeats是YES -> 每隔1秒self去調(diào)用time一次
//定時器一創(chuàng)建就開啟了
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(method) userInfo:nil repeats:NO];
//暫停定時器
[timer setFireDate:[NSDate distantFuture]];
//開啟定時器
[timer setFireDate:[NSDate distantPast]];
//================UITextField=================
UITextField * textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 200, 60)];
//2.添加到界面上
[self.window addSubview:textField];
//3.設置背景顏色
textField.backgroundColor = [UIColor whiteColor];
//============和文字相關的屬性==============
//文字
textField.text = @"俄 sad sad";
//文字顏色
textField.textColor = [UIColor brownColor];
//字體
textField.font = [UIFont systemFontOfSize:10];
//對齊模式
textField.textAlignment = NSTextAlignmentCenter;
//占位文字,(它的顏色是淺灰色,不能被改變)
////顯示的條件是當前的text為空
textField.placeholder = @"請輸入名字";
//6.是否在開始編輯的時候清空文字(默認是 NO)
textField.clearsOnBeginEditing = YES;
//=============和顯示相關的屬性===============
//設置邊框風格 Border Style
[textField setBorderStyle:UITextBorderStyleRoundedRect];
//設置清除按鈕模式
[textField setClearButtonMode:UITextFieldViewModeAlways];
//設置左視圖
UILabel *leftLable = [[UILabel alloc]initWithFrame:CGRectMake(100, 100, 40, 40)];
leftLable.text = @"賬號";
textField.leftView = leftLable;
[textField setLeftViewMode:UITextFieldViewModeAlways];
//是否處于編輯狀態(tài)
BOOL ret = textField.isEditing;
系統(tǒng)整理
最后編輯于 :
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。
相關閱讀更多精彩內(nèi)容
- 一、對聯(lián)的分類 【正對】 又正名對。切對。正正相對。 天——地,好—惡,去—來,明—暗,方—圓等等。 如: 東圃青...
- 之前項目中有個關于橫豎屏的需求,原本以為是很簡單的事情,隨便一些就能解決,但結果發(fā)現(xiàn)事實并不是這樣。網(wǎng)上也搜索了很...
- 上圖是硬件、軟件和操作系統(tǒng)的關系。軟件是運行在硬件上的,可以看到,硬件和軟件通過操作系統(tǒng)來交互。 操作系統(tǒng)分類 1...