Time of Update: 2013-12-10
就用這就能開啟safari;NSURL* url = [[ NSURL alloc ] initWithString :@"http://www.baidu.com"];[[UIApplication sharedApplication ] openURL: [url autorelease ]];如果當webView內部開啟連結時用safari當然這必須委託給自己webView.delegate=self;也當然要加
Time of Update: 2013-12-10
在代碼中調用如下代碼:NSURL*url=[NSURL URLWithString:@"prefs:root=NOTIFICATIONS_ID"];[[UIApplication sharedApplication] openURL:url];即可跳轉到設定頁面的對應項。About — prefs:root=General&path=AboutAccessibility —
Time of Update: 2013-12-10
以前一直沒有注意過iPhone開發中反射的用法,java C#等也都是有反射的,用起來還是挺方便的,因為目前開發的需要,就想到了用反射來完成一下。 1.通過類名來建立對象 Class testClass=NSClassFromString(@”testClass”); id object=[[testClass alloc] init]; 2.通過反射的方式,實現該對象的指定函數 例如:我想調用object
Time of Update: 2013-12-10
Prepare Provisioning profile:Keychain Access-->Certificate Assistant-->Request a Certificate from a Certificate Authority-->input email address (App ID), saved to disk. Sign in https://developer.apple.com-->iOS Provisioning Portal--&
Time of Update: 2013-12-10
在.plist裡添加 Application supports iTunes file sharing YES,這樣就可以在itunes查看日誌了,非常方便!NSFileManager * filemangage =[NSFileManager defaultManager]; NSArray *paths= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
Time of Update: 2013-12-10
上一篇:http://www.bkjia.com/kf/201301/185018.htmlUINavigationController實現導航在App委託中的.h檔案裡@property( nonatomic ,strong)UINavigationController *nav;.m檔案裡@synthesize nav;-(BOOL)application:(UIApplication *)application
Time of Update: 2013-12-10
使用UISlider實現指定範圍選取建立一個滑動條並且把它放在試圖控制器的視圖中。@interface SliderView:UIViewController@property(non atomic,strong)UISlider *mySlider;@end@synthesize mySlider;-(void)viewDidLoad{ [super viewDidLoad]; self.view.backgroundColor =
Time of Update: 2013-12-10
上一篇:http://www.bkjia.com/kf/201301/185441.htmlTableView是一個被分成不同部分的滾動視圖,每一部分又進一步被分成行,每行是一個UITableViewCell類的執行個體。可以把圖片,文本和其他任何東西嵌入tableView儲存格,可以自訂他們的形狀,高度,分組或更多。這些分別在UITableViewDataSource和UITableViewDelegate的協議來定義。 #import<UIKit/UIKit.h>&nb
Time of Update: 2013-12-10
網路判斷需要包含Reachability.h庫,判斷函數如下:+ (NSString *)checkNetWork{ Reachability *reachAble = [Reachability reachabilityWithHostName:@"www.baidu.com"]; switch ([reachAble currentReachabilityStatus]) {
Time of Update: 2013-12-10
我們在開發的過程中難免會用到低版本中沒有的類,如果我們想讓我們的應用儘可能的相容多個版本,我們需要考慮如果我們使用的類在低版本中沒有怎麼辦呢。 Class pkClass=NSClassFromString(@"PKAddPassesViewController"); if (pkClass) { NSLog(@"available");/
Time of Update: 2013-12-10
NSMutableDictionary - (void)setObject:(id) for :(NSstring *)key 當id 為 nil,會出現 crash。 但是,當用setValue 則沒有事情。目前 Dic 用setValue 代替 setObject
Time of Update: 2013-12-10
很多Git命令都是在命令列下啟動並執行,命令列下管理Git有很多優點不用多說。但最大的缺點是要求使用者記住這些命令。因此Git圖形介面還是很受一些使用者歡迎的,其中Xcode作為整合式開發環境工具,也提供了一定Git圖形介面功能。但是要想在Xcode中使用Git管理工程代碼還想需要進行一些配置,然後才能使用。 如果我們是使用Xcode 4建立的一個iOS工程,在終端的命令列中提交代碼時候,可能會出現下面的部分資訊: [cpp] create mode 100644
Time of Update: 2013-12-10
捕捉螢幕CALayer執行個體使用Core Graphics的renderInContext方法可以將視圖繪製到映像上下文中以便轉化為其他UIImage執行個體。前提先#import+ (UIImage *) imageFromView: (UIView *)theView { // draw a view's contents into an image context
Time of Update: 2013-12-10
iphone QQ協議,QQ iphone協議 QQ Iphone登陸協議其實只要兩個包即可。 沒解之前感覺神秘莫測,解完之後感覺QQ也真是膽大啊!以下為網上抄來的一段,不同版本協議加密方法一樣,只是特徵碼大同小異而已。 [NO.1 2013-02-18 12:59:15 383 SEND 482位元組]00 00 01 E2 00 00 00 03 02 00 00 00 04 00 00 0000 0C 31 31 31 31 31 31 31 31 E6 B0 29
Time of Update: 2013-12-10
如果一個UIView關聯多個UIGestureRecognizer, 會發生一個奇怪的問題,如下面代碼[cpp] UIPanGestureRecognizer *pang = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panned:)]; [self.view
Time of Update: 2013-12-10
1 前言UIPickerView(選取器)也是出鏡率相當高的控制項,類似與HTML中的Select,今天我們就一起來學習一下這個控制項。2 UIPickerView簡介關鍵代碼:.h檔案:[plain]#import <UIKit/UIKit.h> //需要實現UIPickerViewDataSource,UIPickerViewDelegate協議 @interface ZYViewController :
Time of Update: 2013-12-10
1 前言UITextView可以在一個滑動視圖裡面顯示多行文本。2 代碼執行個體ZYViewController.h:[plain] #import <UIKit/UIKit.h> @interface ZYViewController : UIViewController @property(nonatomic,strong) UITextView
Time of Update: 2013-12-10
1 前言平時做App的時候總會遇到,UITextField的鍵盤會遮擋住下面的內容,由於IOS沒有自己的機制,所以需要自己寫方法來控制,今天我們就介紹一種簡單的方法,來應對鍵盤遮擋問題。2 代碼執行個體ZYViewController.h [plain]#import <UIKit/UIKit.h> @interface ZYViewController :
Time of Update: 2013-12-10
1 前言使用 dispatch_once 函數 在 APP 的生命週期內來保證你想確保每段代碼只執行一次,即使它在代碼的不同地方多次調用(比如單例的初始化)。 2 代碼執行個體ZYAppDelegate.m [plain]/一個用於調度一次函數的標識 static dispatch_once_t onceToken; //Block Object void (^executedOnlyOnce)(void) =
Time of Update: 2013-12-10
1 前言今天我們來學習使用 UIView 的動畫方法來移動你的視圖。2 代碼執行個體ZYViewController.m: [plain]- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a