Time of Update: 2018-12-06
用到知識:1.計時器NSTimer 2.UIWebView控制項
Time of Update: 2018-12-06
1.// HomeViewController.h// MailDemo#import <UIKit/UIKit.h>#import <MessageUI/MessageUI.h>@interface HomeViewController : UIViewController<MFMailComposeViewControllerDelegate>- (IBAction)displayComposerSheet;@end 2.//// HomeView
Time of Update: 2018-12-06
1.UITouchphase 屬性 返回一個觸摸階段常量,指出觸摸開始、繼續、結束或被取消。(phase返回的常量:UITouchPhaseBegan/UITouchPhaseMoved/UITouch-
Time of Update: 2018-12-06
通過plist檔案存取檔案 在 ios檔案處理(一)的項目中,修改HomeViewController.m的viewDidLoad方法 - (void)viewDidLoad{/* NSString *fileName = [[self documentsPath] stringByAppendingPathComponent:@"content.txt"]; //NSString *fileName = [[self tempPath]
Time of Update: 2018-12-06
主要是3種方式,Core Animation、Core Graphic和OpenGL ES。 操作簡易度:CA>CG>OpenGL 效能和功能度:OpenGL>CG>CA 1.Core Animation 非娛樂類的軟體都會用到的動畫,操作簡單。2.Quartz 2D繪圖 是一個2D繪圖引擎。 (1) 繪圖Context是一個繪圖的目標對象,定義了繪圖的基本屬性,如顏色、繪圖範圍、線寬及樣式等。
Time of Update: 2018-12-06
iphone包含了很多架構和庫,從底層的通訊端到不同層次的封裝,可以方便地給程式添加網路功能。 (1)BSD通訊端。最底層的通訊端,這是Unix網路開發常用的API。如果從其他系統移植程式,而程式用的是BSD通訊端,那麼網路部分可以繼續使用這些API。 (2)CFNetwork framework 。CFNetwork 也是比較底層的, 是對BSD通訊端的一個擴充
Time of Update: 2018-12-06
上面的通過代碼實現:NSString *str = @"字串大小字串大小字串大小字串大小"; UIFont *font = [UIFont fontWithName:@"Arial" size:50.0f]; CGSize size = CGSizeMake(320, 2000); UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero]; [label
Time of Update: 2018-12-06
ios中記憶體管理的主要內容就是解決crash的問題!!!Crash在ios中,crash的原因100% 是記憶體問題1.記憶體泄露(開闢空間,沒有回收;一直開闢,不釋放) 30M(一個程式 3gs, 320x640) 大於30M(ios4,640x960)2.“太小心” 過度釋放 (原因是野指標)3. 野指標記憶體回收機制 : java new一個對象 (不用管記憶體,系統自動回收)mac os 有記憶體回收機制iOS
Time of Update: 2018-12-06
1.系統內建按鈕和表徵圖Using System-Provided Buttons and Icons 2.自訂表徵圖和圖片iphone 內建表徵圖的尺寸一般為29px × 24px,自製的表徵圖最好接近這個尺寸;表徵圖的顏色應該是純白色,可以帶有alpha透明度;縮圖的時候要注意消除鋸齒,檔案格式為PNG。3.程式表徵圖和啟動畫面 Home Screen表徵圖:57px ×
Time of Update: 2018-12-06
1.Alert View 一般給使用者提供警示資訊。 如: UIAlertView *alert =[[UIAlertView alloc] initWithTitle:nil message:@"相機不能用" delegate:nil cancelButtonTitle:@"關閉" otherButtonTitles:nil]; [alert show]; [alert release]; 2.Action
Time of Update: 2018-12-06
常用屬性:frame,bounds和center重要方法 :addSubview 把一個子控制項添加到一個父控制項中;Superview 返回子控制項的父控制項常用函數:- (void)removeFromSuperview; - (void)insertSubview:(UIView *)view atIndex: (NSInteger)index; - (void)exchangeSubviewAtIndex:
Time of Update: 2018-12-06
在.m檔案中修改方法 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 預設為豎屏:- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ return (interfaceOrientation !=
Time of Update: 2018-12-06
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; // Override point for customization
Time of Update: 2018-12-06
建立Empty Application,添加HomeViewController HomeViewController.h代碼 #import <UIKit/UIKit.h>#import <MediaPlayer/MediaPlayer.h> @interface HomeViewController : UIViewController{ MPMoviePlayerViewController *playerViewController;} -
Time of Update: 2018-12-06
1.貼圖為快:2.核心知識(1)聲明代碼:@property (strong, nonatomic) IBOutlet UILabel *userOutput;@property (strong, nonatomic) IBOutlet UITextField *userInput;- (IBAction)setOutput:(id)sender;實現代碼:@synthesize userOutput;@synthesize userInput;void)viewDidUnload{
Time of Update: 2018-12-06
解釋一:1.static NSString *CellTableIdentifier = @"CellTableIdentifier "; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellTableIdentifier]; if (!celll) { cell = [[[UITableViewCell
Time of Update: 2018-12-06
我遇到這樣一個問題:初始化一個字典,初始化的時候,給三個key-value;但是,列印字典的時候,只有第一個元素有值,後兩個沒有值。 NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:_messageString,@"message",_photoImage,@"photo",@"cc",@"record", nil];列印dict的時候:有message,但是沒有photo和record!!!最後找到了原因:因為——
Time of Update: 2018-12-06
nil用來給對象賦值(Objective-C中的任何對象都屬於id類型),NULL則給任何指標賦值,NULL和nil不能互換,nil用於類指標賦值(在Objective-C中類是一個對象,是類的meta-class的執行個體), 而NSNull則用於集合操作,雖然它們表示的都是空值,但使用的場合完全不同。樣本如下:id object = nil; // 判斷對象不為空白 if (object) { } // 判斷對象為空白 if (object == nil) { }
Time of Update: 2018-12-06
代碼實現:RootViewController類的實現:View Code //// RootViewController.m// HttpRequestByBlockTest// 方法1:通過塊(Block)實現回調-本質是函數指標// 方法2:通過函數指標實現回調// Created by hanjun on 13-3-15.// Copyright (c) 2013年 CompanyOfHanJun. All rights reserved.//#import
Time of Update: 2018-12-06
1.函數指標--最本質,最底層的調用2.塊文法--包,本質是通過函數指標調用的3.target-action模式-在函數指標之上的封裝(藉助OC函數名字串通過SEL-@selector來尋找函數指標),不知道要回調的函數(本質上是函數指標)4.委託協議模式--在函數指標之上的封裝(藉助OC函數名字串通過SEL-@selector來尋找函數指標),知道要回調的函數 (本質上是函數指標)5.訊息通知--用單個對象給多個對象發訊息(本質上還是函數指標)