日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ios 开发框架原始雏形 01

發布時間:2024/4/15 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ios 开发框架原始雏形 01 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];if (self) {// Custom initialization }return self; }#pragma mark - Start 數據入口-(void)inputData {//對程序級的全局變量用局部變量獲取出來,然后轉存給當前viewController的全局變量//在當前viewController中,只使用當前類的全局變量,不要在程序中使用 整個程序的全局變量,那樣數據將會失控 }#pragma mark - step 1 畫面開始- (void)viewDidLoad {[super viewDidLoad];[self inputData]; //獲取本類需要用到的基本數據 [self loadBasicView]; //加載最基本的界面//開啟子線程到網絡上獲取數據NSThread *thread1 = [[NSThread alloc]initWithTarget:self selector:@selector(thread1_getData) object:nil];[thread1 setName:@"第一個子線程,用于獲取網絡數據"];[thread1 start]; }#pragma mark - step 2 加載最基本的界面 -(void)loadBasicView {} #pragma mark - step 3 第一個子線程 : 用于獲取網絡數據 相當于為TabelView生成數據源 -(void)thread1_getData {//自定義獲取數據操作//////回到主線程,更新用戶界面 疑問: 用下面這種方式更新界面,會有延遲問題 // [self performSelectorOnMainThread:@selector(updateUI) withObject:nil waitUntilDone:NO];[self updateUI]; //被迫先用這種方式 } #pragma mark - step 4 更新用戶界面 (同時開啟第二個子線程,下載圖片) -(void)updateUI {//更新用戶界面操作,如 [tableView reload]; 等//////開啟單獨的第二個線程 下載主界面的頭圖片,并一個一個進行顯示NSThread *thread2 = [[NSThread alloc]initWithTarget:self selector:@selector(thread2_downLoadImagesForView) object:nil];[thread2 setName:@"第二個子線程,用于下載圖片,并一個一個顯示在主界面"];[thread2 start]; } /* #pragma mark - TableViewDelegateMethods//組的個數 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {return 1; }//行數 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {return 1; }//各項的高 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {return 70 ; }//每個單元行中的內容 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString *cellIdetify = @"cell";UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdetify] autorelease]; cell.selectionStyle = UITableViewCellSelectionStyleGray; //設置分割線的顏色//對cell進行自定義return cell; }//單元格被選中 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {}*/#pragma mark - step 5 開啟第二個子線程:下載圖片,并添加到 self.view 上 -(void)thread2_downLoadImagesForView {}#pragma mark - step 6 處理畫面中的按鈕的響應事件#pragma mark - step7 畫面消失- (void)viewDidUnload {[super viewDidUnload];// Release any retained subviews of the main view.// e.g. self.myOutlet = nil; }- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {return (interfaceOrientation == UIInterfaceOrientationPortrait); }#pragma mark - End 數據出口-(void)outputData {//對類的全局變量進行歸位(或許不必)//對類中輸出的數據進行集中管理//用類的全局變量對應用程序級全局變量進行管理 }

?

總結

以上是生活随笔為你收集整理的ios 开发框架原始雏形 01的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。