成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

iPhone編程添加遞進(jìn)式子視圖實(shí)例學(xué)習(xí)

移動(dòng)開發(fā) iOS
iPhone編程添加遞進(jìn)式子視圖實(shí)例學(xué)習(xí)是本文要介紹的內(nèi)容,主要是來系統(tǒng)的來學(xué)習(xí)iphone編程中的一些細(xì)節(jié)問題,來看本文內(nèi)容詳解。

iPhone編程添加遞進(jìn)式子視圖實(shí)例學(xué)習(xí)是本文要介紹的內(nèi)容,主要是來系統(tǒng)的來學(xué)習(xí)iphone編程中的一些細(xì)節(jié)和視圖的相關(guān)問題,來看本文內(nèi)容詳解。iPhone編程中心采用兩種重要的范型:

面向?qū)ο蠓缎?/strong>

模型-視圖-控制器(MVC)設(shè)計(jì)模式

iPhone上的MVC劃分:

視圖       

由UIView類以及子類以及其相關(guān)的UIViewController類提供。PS:關(guān)于此處Controller,個(gè)人認(rèn)知為一個(gè)容器,用于保存UIView類的實(shí)例,同時(shí)負(fù)責(zé)對(duì)屏幕中各項(xiàng)進(jìn)行布局。

控制器      
 
通過3中關(guān)鍵技術(shù)實(shí)現(xiàn):委托、目標(biāo)操作和通知

模型      
 
模型方法拖過數(shù)據(jù)源和數(shù)據(jù)含義等協(xié)議提供數(shù)據(jù),需要實(shí)現(xiàn)由控制器觸發(fā)的回調(diào)方法。

實(shí)例學(xué)習(xí)

在實(shí)踐Pdf版書中P47的例子中,通過蘋果官網(wǎng)資料學(xué)習(xí):

UIView類

常用屬性:

  1. superview  
  2. subviews  
  3. window  
  4. autoresizingMask UIViewAutoresizing常量,
  5. 常用UIViewAutoresizingFlexibleWidth and UIViewAutoresizingFlexibleRightMargin  
  6. autoresizesSubviews    標(biāo)記子視圖是否自動(dòng)重設(shè)大小  
  7. tag    標(biāo)識(shí)視圖的標(biāo)簽 

常用方法:

  1. addSubview  
  2. insertSubview  
  3. removeFromSuperview  
  4. viewWithTag    通過標(biāo)識(shí)獲取視圖指針 

UIViewController類

為蘋果應(yīng)用程序提供基本的view-management(視圖管理)模型。

UINavigationController,UITabBarController是此類的子類,提供額外行為操作來管理復(fù)雜層次關(guān)系視圖控制器和視圖。

常用屬性:

view:

當(dāng)前控制器管理的視圖,為控制器當(dāng)前可見的視圖

常用方法:

loadView:

創(chuàng)建視圖用于控制器使用。

willRotateToInterfaceOrientation:

用于屏幕翻轉(zhuǎn)告知控制器,以響應(yīng)對(duì)應(yīng)的改變

shouldAutorotateToInterfaceOrientation:

返回一個(gè)Bool值,來指示當(dāng)前視圖控制器是否支持指定的方向   

此函數(shù)涉及一個(gè)常量,如下:

UIInterfaceOrientation常量:

  1. typedef enum {  
  2.    UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,  
  3.    UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,  
  4.    UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeRight,  
  5.    UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeLeft 
  6. } UIInterfaceOrientation; 

用于判斷用戶的屏幕橫放和豎放是否支持。比如:看視頻,一般都是橫起看,那么取值只能UIDeviceOrientationLandscapeRight UIDeviceOrientationLandscapeLeft。完整代碼如下:

  1. // Allow the view to respond to 2 iPhone Orientation changes,like:  
  2. -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation  
  3. {  
  4.     return (interfaceOrientation == UIDeviceOrientationLandscapeRight || interfaceOrientation == UIDeviceOrientationLandscapeLeft);  

幾何類型結(jié)構(gòu):

CGRect

  1. A structure that contains the location and dimensions of a rectangle.  
  2.  
  3.     struct CGRect {  
  4.        CGPoint origin;  
  5.        CGSize size;  
  6.     };  
  7.     typedef struct CGRect CGRect; 

CGPoint

  1. A structure that contains a point in a two-dimensional coordinate system.  
  2.  
  3.     struct CGPoint {  
  4.        CGFloat x;  
  5.        CGFloat y;  
  6.     };  
  7.     typedef struct CGPoint CGPoint; 

CGSize

  1. A structure that contains width and height values.  
  2.  
  3.     struct CGSize {  
  4.        CGFloat width;  
  5.        CGFloat height;  
  6.     };  
  7.     typedef struct CGSize CGSize; 

CGFloat

  1. The basic type for all floating-point values.  
  2. typedef float CGFloat;// 32-bit  
  3. typedef double CGFloat;// 64-bit 

小結(jié):iPhone編程添加遞進(jìn)式子視圖實(shí)例學(xué)習(xí)的內(nèi)容介紹完了,希望本文能對(duì)你有所幫助!

責(zé)任編輯:zhaolei 來源: 博客園
相關(guān)推薦

2011-07-22 17:24:46

iPhone 視圖

2011-07-18 15:32:14

iPhone 錄音 播放

2011-08-11 16:19:11

iPhoneCocoa

2011-08-15 18:02:32

iPhone開發(fā)表視圖

2011-07-26 15:56:53

iPhone 游戲 啟動(dòng)畫面

2011-08-08 15:56:18

iPhone 震動(dòng) NSUserDefa

2011-07-28 14:19:12

iPhone 網(wǎng)絡(luò)編程 聊天程序

2021-04-30 18:50:44

網(wǎng)絡(luò)安全PE編程添加節(jié)區(qū)

2011-07-25 18:02:51

iPhone LibFetion 移植

2011-07-21 17:29:42

iPhone Sqlite 數(shù)據(jù)庫

2011-07-29 10:51:41

iPhone 全屏顯示 視圖

2009-09-23 15:12:41

Hibernate視圖

2011-08-12 11:23:47

iPhone窗口視圖

2011-07-21 16:48:19

iPhone 游戲

2011-07-27 17:45:29

iPhone 模擬器 圖片

2009-08-28 17:51:40

iPhone多視圖開發(fā)

2011-08-08 16:56:44

iPhone 字符處理 視圖

2011-07-18 13:37:53

2011-07-06 16:15:46

iPhone 圖片

2011-08-12 10:04:24

iPhone開發(fā)視圖
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)

主站蜘蛛池模板: 国产亚洲一区二区三区在线观看 | 欧美黑人体内she精在线观看 | 欧州一区二区三区 | 国产999精品久久久久久 | 欧产日产国产精品国产 | 狠狠婷婷综合久久久久久妖精 | 日韩免费在线视频 | 国产一区二区成人 | 亚洲欧美日韩久久久 | 91在线观看免费视频 | 成人午夜在线观看 | 罗宾被扒开腿做同人网站 | 国产欧美日韩二区 | 成人精品一区二区三区四区 | 国产精品二区三区 | 欧美日韩高清一区 | 日韩高清一区二区 | 最近日韩中文字幕 | 国产精品久久久久久久一区二区 | 亚洲电影第三页 | 天天操天天摸天天干 | 国产日韩欧美一区 | 一区二区三区久久久 | 日韩在线免费视频 | 久久亚洲欧美日韩精品专区 | 亚洲欧美一区二区三区视频 | 99热在线播放 | 国产三级精品三级在线观看四季网 | 久久av网| 欧美v片 | 午夜免费电影 | 一区二区三区精品在线视频 | 亚洲高清视频一区二区 | 久久久精品久久久 | 久久久久国产精品一区二区 | 中文字幕国产视频 | 狠狠色网 | 日韩一区二区三区在线 | 操操网站 | 日本精品在线播放 | 亚洲第一福利网 |