Time of Update: 2013-12-10
IOS中,如果要在主線程中啟動一個子線程,可以又兩種方法:[cpp] [NSThread detachNewThreadSelector:@selector(myThreadMainMethod:) toTarget:self withObject:nil]; 這是在cocoa早期提供的方法,因此你可以在任何版本的ios和mac上調用此方法。在 OS X v10.5(or
Time of Update: 2013-12-10
如果IOS App 使用到CoreData,並且在上一個版本上有資料庫更新(新增表、欄位等操作),那在覆蓋安裝程式時就要進行CoreData資料庫的遷移,具體操作如下:1.選中你的mydata.xcdatamodeld檔案,選擇菜單editor->Add Model Version 比如取名:mydata2.xcdatamodel2.設定目前的版本 選擇上級mydata.xcdatamodeld ,在inspector中的Versioned Core
Time of Update: 2013-12-10
關於NSJSONSerialization,官方文檔中有如下介紹:You use the NSJSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON. An object that may be converted to JSON must have the following properties: The top
Time of Update: 2013-12-10
關於推送的機制和推送用到的認證問題在這裡不多說。 關於推送的代碼部分: 用戶端: 1、告訴應用程式,接收push來的訊息(當然是放在 didFinishLaunchingWithOptions 方法裡面了) [cpp] [application
Time of Update: 2013-12-10
在 XCode 4.2 (with LLVM):裡 -(void)release { } 會彈出警告 warning: Semantic Issue: Conflicting distributed object modifiers on return type in implementation of 'release' 為了去掉警告 修改如下 :
Time of Update: 2013-12-10
使用UIButton給使用者介面添加按鈕@property(nonatomic,strong)UIButton *myButton;@synthesize myButton;-(void)buttonIsPressed:(UIButton *)paramSender{ NSLog(@"Button is pressed.");}-(void)buttonIsTapped:(UIButton *)paramSender{
Time of Update: 2013-12-10
從今天開始我要分期把我的IOS學習期間的筆記發出來,以協助剛入門的朋友們能夠更快的掌握IOS的編程方法,也供自己以後有個回看的筆記。 有些地方可能不太詳細,但是只要你一步一步的按照學下去,不懂的尋找資料,一定能夠學好的。 Objective-C 語言中如何聲明變數命名規則 駝峰規則 不要有特殊字元資料類型NSInteger 可以表示負數 整形變數 NSUInteger 不可以表示負數Float 浮點型的資料,例如
Time of Update: 2013-12-10
1.手指點擊事件[html] //單指單擊 UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self
Time of Update: 2013-12-10
OC 寫法:-(NSInteger)subtract:(NSInteger)paramValue from:(NSInteger)paranFrom{ return paramFrom - paramValue;}C寫法:NSInteger subtract(NSInteger paramValue,NSInteger paramFrom){ return paramFrom - paramValue;www.2cto.com}Block
Time of Update: 2013-12-10
故事板實現標籤導航 用故事板技術實現標籤導航模式。 使用“Tabbed Application”模版,建立一個名為 “TabNavigationStoryborad”的工程。勾選“Use Storyborads”、“Use Automatic Reference
Time of Update: 2013-12-10
由於覺得網上對於NSPredicate講解比較粗略,所以打算先看文檔,奈何英語水平有限,故先翻譯一遍,加深理解(如有錯誤,歡迎指正)。 概覽 NSPredicate類是用來定義邏輯條件約束的擷取或記憶體中的過濾搜尋。 您可以使用謂詞來表示邏輯條件,用於描述對象持久性儲存在記憶體中的對象過濾。雖然從 NSComparisonPredicate,
Time of Update: 2013-12-10
- (void)viewDidLoad{ [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];}-
Time of Update: 2013-12-10
Reachability是蘋果官方給的檢查網路狀態的庫,想必每個基於網路的應用都會用它來檢查網路狀態吧,當然筆者也不例外.可是正當自信滿滿的我,用這個庫用的不亦樂乎的時候,突然發現我寫的基於網路的程式工作的不是那麼流暢了,尤其是仔細檢查以後確定是因為用了Reachability的時候,一下子覺得的不可理喻,這瞬間的落差讓前一分鐘還在美滋滋的認為”寫程式是藝術,用程式是享受”的我情何以堪?這種情況就是:串連到了Wifi,但是並不能上網.這時候用Reachability檢查會
Time of Update: 2013-12-10
iphone5的螢幕解析度:1136 x 640 也即是高度變成了568,程式啟動時我們需要一張retina圖片命名為Default-568h@2x.png。在我們建立工程時xcode會預設為我們建立一個純黑色的圖片替換即可。 xcode 4.5 已經支援iphone5的模擬器了。 開啟模擬器,選擇裝置,選擇iphone(Retina
Time of Update: 2013-12-10
1 前言UISegmentedController類似於選項按鈕,可以提供選擇操作,今天我們就來學習一下其簡單用法。2 UISegmentedController簡介上代碼.h檔案[plain]#import <UIKit/UIKit.h> @interface ZYViewController : UIViewController @property(nonatomic,strong) UISegmentedControl
Time of Update: 2013-12-10
1 前言UILabel可以顯示給使用者靜態文本,並且控制文本的字型和顏色,今天我們來學習一下UILabel。2 代碼執行個體ZYViewController.h:[plain]#import <UIKit/UIKit.h> @interface ZYViewController : UIViewController @property(nonatomic,strong) UILabel
Time of Update: 2013-12-10
正常情況下,在AppDelegate中實現下面兩個方法,能夠監聽從後台恢複到前台[cpp] - (void)applicationDidEnterBackground:(UIApplication *)application { log4info(@"---applicationDidEnterBackground----");
Time of Update: 2013-12-10
1 前言當執行那些與 UI 無關的任務,或者與 UI 互動的任務時,和執行其他任務一樣,會需要大量時間,以上情況會經常出現。我們可以使用 dispatch_sync函數在一個指派隊列上執行同步任務。你必須做的事情就是提供一個此隊列的控制代碼了,這個隊列必須運行任務,並且一個代碼塊會在這個隊列上執行。 今天我們就來學習一下GCD執行非UI的操作。2 代碼執行個體TestDemo.h [plain]#import <Foundation/Foundation.h> &
Time of Update: 2013-12-10
1 前言如果我們原來的項目中沒有Storyboard,不要著急,我們今天就來教你如何添加Storyboard。2 代碼執行個體2.1 在原來項目中建立一個Storyboard 2.2 選擇裝置類型 2.3 設定Storyboard的名稱 2.4 在AddStoryboardTest-Info.plist中添加節點 UIMainStoryboardFile 值為Storyboard的名字:iPhone 2.5
Time of Update: 2013-12-10
1 前言用 CGPathAddRect 向路徑中添加一個矩形,然後在圖形環境上繪製這條路徑。2 代碼執行個體ZYViewControllerView.m [plain] - (void)drawRect:(CGRect)rect{ //建立圖形路徑控制代碼 CGMutablePathRef path =