Time of Update: 2013-12-10
想在一個類裡把個數組寫進.plist檔案裡,再在另一個類裡從這個.plist檔案把數組讀取出來?以name,phoneNumber,age三個欄位,為例。我是做的iphone,在文字框中輸入資料,擷取後,裝入數組中。然後把數組寫入.plist檔案寫操作 NSString *name=[txt1 text]; NSNumber *phoneNumber=[[NSNumber alloc] initWithInt:[[txt2
Time of Update: 2013-12-10
當應用程式掛起,而不是徹底退出時,此應用程式的所有有效性將被暫停,這時候如果需要播放音頻或者是視頻,就需要啟用播放“單常式”,以確保播放模組不會被掛起。讓音頻或者是視頻繼續在背景播放,而不因為程式的掛起而終止。只需要在程式中的相應位置加如下代碼:NSError *myErr; BOOL bAudioInputAvailable =
Time of Update: 2013-12-10
IPhone上木有記憶體回收,動態申請的記憶體要自己記得釋放,此文自己總結一下可能出現記憶體泄露的各種情況,以及檢測方法。 記憶體泄露說白了,就是有這樣一塊動態申請的記憶體,但木有任何一個指標指向它。 舉例來說,在C++中: 1. MyClass * foo = new MyClass; 2. foo = NULL; 類似地在objective-C中: 1. MyClass *foo =
Time of Update: 2013-12-10
學了iPhone的CoreLocation之後,再回想Android的定位開發,真是省事了不少,iPhone對定位功能開發這一模組封裝的很好,只需幾步,便可以擷取到裝置所在的位置等多項參數! 1.啟動XCode4.3.2,單擊功能表項目File->New->Project...,以Sigle View Application模板建立項目,並命名為WhereAmI: &
Time of Update: 2013-12-10
IOS中的動畫右兩大類1.UIView的視圖動畫2.Layer的動畫 UIView的動畫也是基於Layer的動畫動畫的代碼格式都很固定1.UIView動畫一般方式[UIView beginAnimations:@"ddd" context:nil];//設定動畫[UIView commitAnimations]; //提交動畫這兩個是必須有的,然後在兩句的中間添加動畫的代碼[UIView beginAnimations:@"ddd"
Time of Update: 2013-12-10
知識點:*UIViewController的shouldAutorotateToInterfaceOrientation方法被deprecated。在ios6裡,是使用supportedInterfaceOrientations and shouldAutorotate 2個方法來代替shouldAutorotateToInterfaceOrientation。注意:為了向後相容iOS 4 and
Time of Update: 2013-12-10
擷取當前裝置可用記憶體(單位:MB)- (double)availableMemory{ vm_statistics_data_t vmStats; mach_msg_type_number_t infoCount = HOST_VM_INFO_COUNT; kern_return_t kernReturn =
Time of Update: 2013-12-10
1.MVC(模型-視圖-控制器).Cocoa Touch設計者採用MVC範型作為指導原則,用於拆分GUI(圖形化介面)應用程式代碼的邏輯方法2.Moudle模型:儲存和處理應用程式資料的類(通常是設計一些ObjC類) View視圖:視窗、控制項等和使用者互動的元素組成的部分
Time of Update: 2013-12-10
本來是想介紹“Building NativeiOS Apps with Wax: Creating a Sample Application”一文的第二部分,它介紹了一個從iOS擷取twitter主題的Wax Application實現過程。其中,twitter的資料是用JSON封裝的 。但很不幸,由於眾所周知的原因,國內的使用者無法直接存取twitter的伺服器 。 因此我修改了這個例子,改為用HTTP+XML的,伺服器端用java實現,在調試時你可以把服務端放在本地,
Time of Update: 2013-12-10
[cpp] view plaincopy<pre name="code" class="cpp"> NSIndexPath *indexPathOfOwnerCell = nil; /* Also, make sure the selected text field is visible on the screen */ //擷取每個section裡共有多少個cell
Time of Update: 2013-12-10
[java]<P style="TEXT-ALIGN: left; PADDING-BOTTOM: 0px; LINE-HEIGHT: 26px; BORDER-RIGHT-WIDTH: 0px; LIST-STYLE-TYPE: none; MARGIN-TOP: 0px; FONT-FAMILY: Arial; WORD-WRAP: normal; MARGIN-BOTTOM: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH:
Time of Update: 2013-12-10
1.- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view; 文檔解釋:Converts a rectangle from the receiver’s coordinate system to that of another
Time of Update: 2013-12-10
原問題描述:我用NSUserDefault檢測應用首次被開啟:[plain] BOOL didRunBefore = [[NSUserDefaults standardUserDefaults] boolForKey:@"didRunBefore"]; if (!didRunBefore) { //Your
Time of Update: 2013-12-10
1.手指點擊事件[html] //單指單擊 UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self
Time of Update: 2013-12-10
原問題描述:開發了一個IOS應用,在文檔目錄中有一些檔案,需要檢測這些檔案是否被編輯或者更改過。不知道應該怎麼實現?還有如果擷取最後一次修改的時間? 解決方案:下面的代碼可以得到檔案修改時間:[plain] www.2cto.comNSFileManager* fileManager = [NSFileManager defaultManager]; NSDictionary* attributes = [fileManager
Time of Update: 2013-12-10
[cpp]NSData *bodyData = [[bodyString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]dataUsingEncoding:NSUTF8StringEncoding];//把bodyString轉換為NSData資料 NSURL *serverUrl = [[NSURL URLWithString:RequestUrl]
Time of Update: 2013-12-10
我們運行程式,如果網速很慢,查詢的時候會一直黑屏,直到請求結束畫面才出現,這樣使用者體驗很不好。因此同步請求一般只是在某個子線 程中使用,而不在主線程中使用。非同步請求的使用者體驗要比同步請求好,因此一般情況下非同步請求用的很多。等待過程中在狀態列上會出現網路等待指標的經典旋
Time of Update: 2013-12-10
根據我們製作優秀的 iOS 應用的經驗,我們認為設計師應該在心裡的牢記適用於 iOS 的 5 件事。雖然本文關注的重點只在 iOS 應用,但大部分的意見也適用於其他移動平台。 1.
Time of Update: 2013-12-10
1 前言UIProgressView控制項用來顯示進度條描述某個任務的進度。2 代碼執行個體ZYViewController.h:[plain] view plaincopyprint?#import <UIKit/UIKit.h> @interface ZYViewController : UIViewController @property(nonatomic,strong) UIProgressView *progressView;&
Time of Update: 2013-12-10
分組表中每個分組都是一個分區,在索引表中,每個索引都是一個分區。實現一個簡單的表:首先在xib檔案中拖入一個tableview,將其dataSource和delegate串連到File‘s owner@interface Hello_WorldViewController : UIViewController