UI初級(jí):
第一天
第二天
第三天
UINavigationController:導(dǎo)航控制器 (導(dǎo)航棧型結(jié)構(gòu))盟萨,? ? ? 默認(rèn)顯示棧頂控制器,需要根視圖控制器來(lái)顯示界面元素(window 一樣)
UILabBarController
主頁(yè) 》》 詳情 : init property
詳情 》》主頁(yè) : notification delegate
UIView:
5要素:持續(xù)時(shí)間;線性規(guī)律;動(dòng)畫(huà)類型邑彪;回調(diào)方法非迹;其他配置
begainAnomator
commitAnimaion : 提交動(dòng)畫(huà)
setAnimationTransition:轉(zhuǎn)場(chǎng)動(dòng)畫(huà)
UIImageView
UIScrollView
1.繼承UIView
contentOffset:設(shè)置當(dāng)前可見(jiàn)內(nèi)容的便宜位置
contentSize:當(dāng)前內(nèi)容空間大小
contentInset:設(shè)置內(nèi)容空間偏移量
pagingEnabke:設(shè)置是否可以翻頁(yè)
scrollEnable:設(shè)置是否滾動(dòng)
showsHorizontalScrollIndicator:設(shè)置是否顯示橫向條
2.代理方法
(void)scrollViewDidScroll
(void)scrollViewDidEndDragging(dragging : 拖動(dòng))
3.
UIPageControl
繼承UIView
用于分頁(yè)顯示 指示頁(yè)面顯示
numberOfPage
currentPage
pageOmdiator
currentPageIndicatorColor
userInteractionEnable //開(kāi)啟用戶交互
UITableView
1.繼承UIScrollView
2.僅提供縱向展示效果
3.UITableViewControl 繼承制UITableView
初始化及屬性
風(fēng)格: plain group
屬性: style dataSource delegate editing tableHeaderView
separator reloadData:刷新表視圖,重新調(diào)用數(shù)據(jù)
協(xié)議: UITableViewDatasource 數(shù)據(jù)源
section low how to show
UITableViewCell : 里面有一個(gè)uiview控件作為其他內(nèi)容的容器晃听, imageView textLabel detailTextLabel
typedef NS_ENUM(NSInteger, UITableViewCellAccessoryType) {
UITableViewCellAccessoryNone,? ? ? ? ? ? ? ? ? // don't show any accessory view
UITableViewCellAccessoryDisclosureIndicator,? ? // regular chevron. doesn't track
UITableViewCellAccessoryDetailDisclosureButton, // info button w/ chevron. tracks
UITableViewCellAccessoryCheckmark,? ? ? ? ? ? ? // checkmark. doesn't track
UITableViewCellAccessoryDetailButton NS_ENUM_AVAILABLE_IOS(7_0) // info button. tracks
};
setEdting
delete move
netWorking Request
get:
1.創(chuàng)建request
2.發(fā)送request
3.接收榨咐,解析數(shù)據(jù)
同步
1.創(chuàng)建request
NSMUtableURLRequest * request = [NSMutableURLRequest requestWithRUL : [NSURL URLwithString : @"地址"]];
//如果有頭部介却,必須加,request 必須申明為可變的
[request addvalue : @"你的? apikey" forHTTPHeaderField:@"apikey"];
2.發(fā)送request
NSError * error = nil;
[NSURLConnection sendSychronousRequest : request returningResponse:nil error:&error];
3.接收谴供,解析數(shù)據(jù)
NSData * data = [NSJSONSerialization JSONObjectWithData : data options : NSJSONReadingMutableLeaves error : &error];
異步
1.創(chuàng)建request
同上
2.發(fā)送request? 使用代理 實(shí)現(xiàn)兩種方法
[NSURLConnection connectionWithRequest : request delefate : self];
3.接收块茁,解析數(shù)據(jù)
同上
異步
post:
1.創(chuàng)建request
NSMutableURLRequest * request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString : @"地址"]];
request.timeoutInterval = 10.0;
//可以把數(shù)據(jù)裝到字典里面,然后再取出再賦給body parameterStr
request.HTTPBody = [parameterStr dataUsingEncoding : NSUTF8StringEncoding];
2.發(fā)送request
與get相同? 異步和同步也一樣
3.接收桂肌,解析數(shù)據(jù)
collectionView
數(shù)據(jù)持久化
4種方式: 1.屬性列表 2.對(duì)象列表 3.數(shù)據(jù)庫(kù)存儲(chǔ):SQLLite3 4.Core Data
1.沙盒
每個(gè)應(yīng)用都會(huì)有一個(gè)獨(dú)立的存儲(chǔ)空間沙盒 每個(gè)應(yīng)用都遵守沙盒機(jī)制数焊,各自只能訪問(wèn)自身的沙盒內(nèi)的數(shù)據(jù)
內(nèi)容:
document:存儲(chǔ)用戶自定義的數(shù)據(jù)
library:應(yīng)用程序相關(guān)的數(shù)據(jù)
tmp:存放臨時(shí)文件的地方,重啟時(shí)丟棄
2.NSFileManager
管理沙盒路徑下的文件
3.NSuserDefault 輕量級(jí)數(shù)據(jù)持久話方式
4.plist屬性列表 5.對(duì)象歸檔: 直接存儲(chǔ)為一個(gè)文件崎场,對(duì)對(duì)象來(lái)進(jìn)行歸檔
【基礎(chǔ)知識(shí)】
1.數(shù)據(jù)持久化方法 /** * Archive: 歸檔佩耳,將對(duì)象壓縮為文件 * Core Data: 大數(shù)據(jù) * NSUserDefaults: 輕量數(shù)據(jù)(用戶名、密碼) * Plist: 屬性列表谭跨,靈活性干厚、重用性高 */
2.沙盒主路徑包含以下目錄 /** * Document:存儲(chǔ)用戶自定義數(shù)據(jù) * Library: 存儲(chǔ)應(yīng)用程序相關(guān)數(shù)據(jù) * temp: 存放臨時(shí)文件,當(dāng)iPhone重啟時(shí)螃宙,會(huì)丟失該目錄里面的所有數(shù)據(jù) */
3.路徑獲取方法 /** * 應(yīng)用包路徑: [[NSBundle mainBundle] pathForAuxiliaryExecutable:@""]; * * 沙盒主路徑: NSHomeDirectory(); * Documents路徑:NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject; * Library路徑: NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); * temp路徑: NSTemporaryDirectory() */
AVAudioPlayer
AVAudioPlayer : 音頻播放器 不提供可視化界面 僅能播放本地音樂(lè)文件
AVFoundation框架 沒(méi)有隊(duì)列蛮瞄,只能播飯一個(gè)指定路徑的音頻(單個(gè)聲音),要播放多個(gè)音頻谆扎,需要?jiǎng)?chuàng)建多個(gè)AVAudioPlayer來(lái)實(shí)現(xiàn)挂捅, AVQueuePlayer更強(qiáng)大
屬性:playing duration delegate currentTime numberOfLoops
協(xié)議方法:audioPlayerDidFinishPlaying:
AVAudioPlayer只能播放一個(gè)完整的文件,并不支持流式播放
pan : 用它可以來(lái)調(diào)節(jié)音頻播放時(shí)左右聲道的大小堂湖,如果值是-1.0為完全左聲道發(fā)生闲先,如果是1.0則為完全右聲道發(fā)音状土。
就是可以測(cè)量音頻播放時(shí)實(shí)時(shí)聲道的功率大小,這個(gè)功能可以用于輔助顯示聲音的波浪伺糠,很多電腦上的播放器都有的
MPMoviePlayerController
MediaPlayer框架
/** < 獲取bundle路徑下 inDirectory 路徑內(nèi)的同類型資源 */
NSArray * array = [[NSBundle mainBundle] pathsForResourcesOfType:@"mp3" inDirectory:nil];
for (NSString * name in array) {
NSLog(@"%@",[name lastPathComponent]);
}
name :? ? ? ? ? ? ? ? ? ? //你是我的眼.mp3
name lastPathComponent :? // /Users/rimi/Library/Developer/CoreSimulator/Devices/834D8E40-3F33-4620-B4DC-623D47BF5A80/data/Containers/Bundle/Application/8981CF63-1D33-4BF5-879E-260F30D7FC7C/P_AVAudioPlayer.app/你是我的眼.mp3
refreshControl
Xcode升級(jí)之后插件失效解決辦法 ( 1.打開(kāi)終端蒙谓,輸入以下代碼獲取到DVTPlugInCompatibilityUUID defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID (2.然后輸入如下命【最后一項(xiàng)是獲取到的DVTPlugInCompatibilityUUID】 find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90
復(fù)習(xí)
1.程序的生命周期
2.UIWindow : UIWindow是一種特殊的UIView
當(dāng)Level層級(jí)相同的時(shí)候,只有第一個(gè)設(shè)置為KeyWindow的顯示出來(lái)训桶,后面同級(jí)的再設(shè)置KeyWindow也不會(huì)顯示彼乌。
3.視圖層級(jí)關(guān)系 : tag交換視圖層級(jí) insertsubView
4.模態(tài)切換:present dismiss
俯視圖:A dismiss 子視圖:B 》》presented取得控制器B
5.UITextField (clear button model,placeholder , )
6.動(dòng)畫(huà)4要素 : 持續(xù)時(shí)間 線性規(guī)律 動(dòng)畫(huà)類型 回調(diào)方法 其他配置(重復(fù)次數(shù) 是否反向執(zhí)行) transform 變幻屬性 : CGAffine... 設(shè)置轉(zhuǎn)場(chǎng)效果 transition
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:<#(UIView *)#> cache:NO];
7.UInavigation;
標(biāo)題顏色:
[self.navigationController.navigationBar setTitleTextAttributes:
@{NSFontAttributeName:[UIFont systemFontOfSize:19],
NSForegroundColorAttributeName:[UIColor redColor]}];
[class apperance]
iOS5及其以后提供了一個(gè)比較強(qiáng)大的工具UIAppearance,我們通過(guò)UIAppearance設(shè)置一些UI的全局效果渊迁,這樣就可以很方便的實(shí)現(xiàn)UI的自定義效果又能最簡(jiǎn)單的實(shí)現(xiàn)統(tǒng)一界面風(fēng)格慰照,它提供如下兩個(gè)方法。
(id)appearance 這個(gè)方法是統(tǒng)一全部改琉朽,比如你設(shè)置UINavBar的tintColor毒租,你可以這樣寫(xiě):[[UINavigationBar appearance] setTintColor:myColor];
(id)appearanceWhenContainedIn:(Class <>)ContainerClass,... 這個(gè)方法可設(shè)置某個(gè)類的改變:例如:設(shè)置UIBarButtonItem 在UINavigationBar、UIPopoverController箱叁、UITabbar中的效果墅垮。就可以這樣寫(xiě) [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], [UIPopoverController class],[UITabbar class] nil] setTintColor:myPopoverNavBarColor];
UIApplication
[UIApplication shareApplication]
main () > UIapplicationMain ()
內(nèi)容: UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
工作:
1,從給定的類名初始化應(yīng)用程序?qū)ο蟾跏蓟疷Iappllication或者子類對(duì)象的一個(gè)實(shí)例算色,(nil 則 默認(rèn)UIApplication)
2.從給定的應(yīng)用程序委托類,初始化一個(gè)應(yīng)用程序委托螟够,并把該委托設(shè)置為應(yīng)用程序的委托灾梦,(nil : 訪問(wèn)Info.plist 尋找nib文件,獲取應(yīng)用程序委托)
3.啟動(dòng)主時(shí)間循環(huán)
單例
設(shè)置狀態(tài)欄信息
8.UITabBarController 標(biāo)簽控制器
9.獲取狀態(tài)欄 1.UIApplication 2.info.plist 3.- (UIStatusBarStyle)preferredStatusBarStyle
10.UITableView : delegate datasource 代理 自定義頭部妓笙,尾部視圖 自定義cell 繼承若河,重寫(xiě) 增刪查改
11.UIScrollView : contentSize contentOffSet cover flow 3D立體滾動(dòng)
12.網(wǎng)絡(luò)請(qǐng)求:get post
13.音樂(lè)播放 : 全局?jǐn)帱c(diǎn)
14.傳值