Time of Update: 2014-03-22
1.Foundation架構中提供了很多的集合類如:NSArray,NSMutableArray,NSSet,NSMutableSet,NSDictionary,NSMutableDictionary但是這些類只能存放OC物件類型的資料2.如果要存放基礎資料型別 (Elementary Data
Time of Update: 2014-03-22
這個我們學習iOS的QuickLook架構實現很簡單,如下:ViewController.h #import #import @interface ViewController : UIViewController@property (strong , nonatomic) QLPreviewController *previewController;@endViewController.m //// ViewController.m//
Time of Update: 2014-03-22
我們先來轉換一個簡單的block代碼: 源:int main() { void (^blk)(void) = ^{printf();}; blk(); return 0; }struct __block_impl { void *isa; int Flags; int Reserved; void *FuncPtr;};struct
Time of Update: 2014-03-22
直接貼代碼了#import "ViewController.h"@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad{ [super viewDidLoad]; NSLog(@"----%@---",[self decimalwithFormat:@"0.0000" floatV:0.334]); NSLog(@"----%@---",[self
Time of Update: 2014-03-22
本來以為自訂cookie能夠把一個域中的cookies,帶給另外一個域來使用.實際中沒有考慮到伺服器也是根據域進行邏輯限定的,最終無法使用的.下面的代碼當作證明過程中的一個關鍵區段實現吧. NSArray *tmp_Cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:@"http://www.thirtydevs.com"]]; NSLog(@"1:%
Time of Update: 2014-03-22
blocks blocks是c語言的擴充,他是:帶有自動變數(局部變數)的匿名函數。 這個概念叫做:閉包。如python中的lambda,在c++11中也引入了lambda; 維基百科中關於閉包:閉包(Closure)是詞法閉包(Lexical
Time of Update: 2014-03-22
1. __weak修飾符的優點,除瞭解決循環參考的問題,在持有某對象的弱引用時,若該對象被廢棄,則此弱引用將自動失效並且處於nil被賦值的狀態(空弱引用)。如: id __wark obj1 = nil;{id _strong obj0 = [[NSObject alloc] init];obj1 = obj0;NSLog(@"A: %@", obj1);}NSLog(@"B: %@", obj1);A:B:(null) 2.
Time of Update: 2014-03-22
PB一種語言無關、平台無關、擴充性好的用於通訊協定、資料存放區的結構化資料序列化方法。支援C++、Python、Java三種語言。Protocolbuf 比XML● 更簡單● 小3-10倍● 快20-100倍● 更少的歧義● 可以方便的產生資料存取類下面是iOS上使用的ppt,有需要原件的請留言!iOS的詳細環境配置見 http://blog.csdn.net/hherima/article/details/17172441html● Xcode 5 / iOS
Time of Update: 2014-03-22
引用計數式的記憶體管理 在arc中是沒有改變的。 在arc中,有有效和無效兩種方式,我們可以在一個app中混合使用。使用clang(LLVM編譯器)或者以上版本,指定編譯器屬性為:"-fobjc-arc"就可以使用arc;在oc中,引用計數式的記憶體管理的思考方式就是思考arc所引起的變化: 1、自己產生的對象,自己持有。 2、非自己產生的對象,自己也能持有。 3、自己持有的對象不再需要時釋放。 4、非自己持有的對象無法釋放。所有權修飾符:
Time of Update: 2014-03-22
項目中為了與Android相配合.要擷取到時間戳記裡的毫秒單位:擷取方法:UInt64 recordTime = [[NSDate date] timeIntervalSince1970]*1000;首先 [[NSDate date] timeIntervalSince1970] 是可以擷取到後面的毫秒 微秒的 ,只是在儲存的時候省略掉了, 如一個時間戳記不省略的情況下為 1395399556.862046 ,省略掉後為一般所見 1395399556 。所以想取得毫秒時用擷取到的時間戳記 *1
Time of Update: 2014-03-22
1.AppDelegate.hvcD4KPHAgY2xhc3M9"p1">2.AppDelegate.m3.ViewController.h4.ViewController.m#import "ViewController.h"@interface ViewController ()@end@implementation ViewController@synthesize bilField;@synthesize tipFieldTen;@synthesize tipFieldFifteen;@
Time of Update: 2014-03-22
最近做項目遇到了上傳圖片這個功能,一直弄了兩天才弄出來,在這裡分享給大家。 首先要上傳圖片並不是直接就把圖片通過URL上傳的,而是要把圖片轉化為二進位檔案。 IOS中有兩個方法,能直接把圖片轉化為二進位 UIImage *image = [UIImage imageNamed:@"8fca9.jpg"]; NSData *data = UIImagePNGRepresentation(image); NSData *data2 =
Time of Update: 2014-03-22
問題描述:CGContextRef ctx = UIGraphicsGetCurrentContext();為什麼會報這個錯誤:is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability有道翻譯:是使用一個無效的上下文,從而導致整體退化系統穩定性和可靠性預設是Nil,在調用
Time of Update: 2014-03-22
解決方案:使用如下代碼: NSDate *date=[_pickerVIew date]; NSDateFormatter *formatter=[[NSDateFormatter alloc]init]; formatter.dateFormat=@"yy-MM-dd HH:mm:ss"; NSString *timeStr=[formatter stringFromDate:date]; NSLog(@"date-----%@",date); NSLog(
Time of Update: 2014-03-22
繼續之前的文章在xcode中又兩個地方設定sdk,一個是Development Target,指的是編譯後的app可再終端的哪個版本上運行,設定方法另外一個是Base SDK,指的是當前編譯所用的SDK版本,設定方法這兩個在開發的時候需要注意,比如用xcode5.0預設的設定開發的app是iOS7.0的,想要適配iOS6.1,需要將Development Target改成iOS 6.1,並且將模擬器設定成iOS6.1,再運行程式的話就是在iOS6.1下邊運行了,但是如果不設定BaseSDK的話,
Time of Update: 2014-03-22
繼續說說ios不同版本之間的適配先說一個東西:在xcode當中有一個東西叫targets,蘋果的官方文檔是這樣說的:A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. A target defines a single product; it organizes the
Time of Update: 2014-03-22
1.先看xib效果然後用模擬器跑出來就是這個樣子了顯然,下面的視圖錯位了根據經驗,可能引發這種問題的原因:1.跟視圖選擇的尺寸問題,選擇的是4寸,結果跑在了3.5寸上面vcD4KPHA+Mi7T0Lj2VXNlQXV0b0xheW91dNGhz+6jrMSsyM/Kx7m00aG1xKOs1eK49tKyv8nE3NL9t6LK0828tO3OuzwvcD4KPHA+My5BdXRvU2l6aW5n0aHU8bXEzsrM4qO6PGltZyBzcmM9"http://www.2cto.com/
Time of Update: 2014-03-22
Foundation架構中常用的類有:NSString、NSArray、NSSet、NSDictionary 以及它們對應的子類
Time of Update: 2014-03-22
判斷裝置是否是ipadBOOL isPad(){#ifdef UI_USER_INTERFACE_IDIOM return(UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPad);#else return NO;#endif}判斷裝置是否是iphone5 #define iPhone5([UIScreen instancesRespondToSelector:@selector(currentMode)]?
Time of Update: 2014-03-21
1.安裝Xcode工具後會內建開發中常用的架構,存放的地址路徑是:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/Frameworks/2.在iOS開發中所有架構中Foundation架構是最基礎的架構,Foundation架構裡麵包含了常用的類和資料類型比如結構體、枚舉等3.使用Foundation架構只要包含