Time of Update: 2013-12-10
過濾字串中的html標籤的方法:[cpp]- (NSString *)filterHtmlTag:(NSString *)originHtmlStr{ NSString *result = nil; NSRange arrowTagStartRange = [originHtmlStr rangeOfString:@"<"];
Time of Update: 2013-12-10
使用最新的新浪微博sdk進行開發時,如果iphone手機是6.0以上的系統時,可以直接調用sso新浪微部落格戶端。只需要在appdelegate中添加下邊四個方法即可- (void)applicationDidBecomeActive:(UIApplication *)application{ // Restart any tasks that were paused (or not yet started) while the application
Time of Update: 2013-12-10
1.從cache檔案夾拷貝到document檔案夾[cpp] NSString *sqlFile = @"test.zip"; NSArray *cachePath= NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString *cacheDir = [cachePath objectAtIndex:0
Time of Update: 2013-12-10
[cpp] UIImageView *peach2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"flower2"]];//聲明一個UIImageView對象,用來添加圖片 peach2.alpha = 0.8;//設定該view的alpha為0.5,半透明的
Time of Update: 2013-12-10
蘋果的每個產品都有幾個類型,從iphone到ipod、ipad,而每個產品又有幾個類型,從iphone2G到iphone5,從iPod touch1到iPod touch5,從ipad1到ipad4,只有你想不到的,沒有人家做不到的。 但是在做ios開發中如何檢測這些類型呢?下邊的方法就是CSDN問答中給出的方法,原問題見:http://ask.csdn.net/questions/997 [plain]- (NSString *) platformString{
Time of Update: 2013-12-10
[cpp] -(void)GetUpdate { NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary]; NSString *nowVersion = [infoDict objectForKey:@"CFBundleVersion"];
Time of Update: 2013-12-10
1. FileInputStream FileOutputStream通過位元組流來讀寫檔案[java] public static void main(String[] args) throws Exception { //將檔案裡寫資料 File f = new File("d:\\dmeo.txt");
Time of Update: 2013-12-10
近來又開始對接UC的SDK對他應用到monodevelop平台上面的時候也是會有一些問題。這裡面是寫的原始碼。我們先看一下產生.a的工程檔案//// UseStaticLibraryUc.h// UseStaticLibraryUc//// Created by huangyushi on 13-1-22.// Copyright (c) 2013年 huangyushi. All rights reserved.// #import &
Time of Update: 2013-12-10
在開發中我們會用到NSNotificationCenter、NSFileManager等,擷取他們的執行個體通過[NSNotificationCenter defaultCenter]和[NSFileManager defaultManager]來擷取,其實這就是單例。我們先看下函數void dispatch_once( dispatch_once_t *predicate, dispatch_block_t
Time of Update: 2013-12-10
表視圖是iOS開發中使用最頻繁的視圖,我們一般都會選擇以表的形式來展現資料,比如通訊錄、頻道列表等。表視圖分段、分組、索引等功能使我們所展示的資料看起來更規整更有調理,更令人興奮的是表視圖還可以利用細節展示等功能多層次的展示資料,正所謂一表勝千言。
Time of Update: 2013-12-10
目前絕大多數的應用都可以實現應用程式更新後,開啟應用就能得到更新提醒。這有利於使用者的更新。 關於如何?的方式,很多人希望Xcode本身能夠提供相應的API來實現對應用版本的尋找,但就目前來看,還沒有這樣的API。因此,目前的解決辦法有兩種:1、自己架設伺服器,當應用程式更新後,就在自己的伺服器中更新版本資訊,然後讓應用串連伺服器來尋找版本資訊,與當前應用版本核對,如果更新則提示2、利用App
Time of Update: 2013-12-10
比如在A版面設定B的delegate為A的執行個體, // A.m中某處B* b = [B alloc] init];b.delegate = self;[self.view addSubview:b];[b release];那麼1.是A負責建立B的,A的生命週期一定比B要長(B存在,A一定也存在;A存在,B不一定存在)也就是說 在B(執行個體b)存在的時候,A(的執行個體)一定存在,
Time of Update: 2013-12-10
[[NSUserDefaults standardUserDefaults] valueForKey:@"SBFormattedPhoneNumber"]; 擷取手機的IMEI#import "Message/NetworkController.h" NetworkController *ntc=[[NetworkController sharedInstance] autorelease]; NSString
Time of Update: 2013-12-10
想用下面的代碼實現一個圓形相框:[plain]CGContextRef context = CGBitmapContextCreate(NULL, self.bounds.size.width, self.bounds.size.height, 8, 4 * self.bounds.size.width, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaPremultipliedFirst); CGContextAddArc(context, 1
Time of Update: 2013-12-10
NSString、NSArray、NSData、NSDictionary都實現了NSCoding協議,可直接通過調用writeToFile歸檔,那麼OBJC自訂物件類型呢?首先實現NSCoding協議,重寫encodeWithCode方法和initWithCode方法,然後通過NSKeyedArchiver轉換為NSData,然後通過NSData的writeToFile方法寫入到檔案,或者將轉換後的NSData放入到NSArray或NSDictionary中調用writeToFile寫入到檔案便
Time of Update: 2013-12-10
UITableView的強大更多程度上來自於可以任意自訂UITableViewCell儲存格。通常,UITableView中的Cell是動態,在使用過程中,會建立一個Cell池,根據每個cell的高度(即tableView:heightForRowAtIndexPath:傳回值),以及螢幕高度計算螢幕中可顯示幾個cell。而進行自訂TableViewCell無非是採用代碼實現或採用IB編輯nib檔案來實現兩種方式,本文主要收集代碼的方式實現各種cell自訂。如何動態調整Cell高度 -
Time of Update: 2013-12-10
//指數運算NSLog(@"%.f", pow(3,2) );//result 9NSLog(@"%.f", pow(3,3) );//result 27 //開平方運算NSLog(@"%.f", sqrt(16) );//result 4NSLog(@"%.f", sqrt(81) );//result 9 //上舍入NSLog(@"res: %.f", ceil(3.000
Time of Update: 2013-12-10
iPhone5出來已經很久了,因為螢幕尺寸的改變,程式對於UI的靈活操控就顯的尤為重要其實這次的總結還是用的老API中相關的屬性,只不過以前我們沒有深入的考慮,或者說是我沒有深入考慮吧 先從viewController的view說起吧(以下代碼全部為ARC環境下)手動建立view都是從loadView方法中初始化viewController的self.view,這裡說API中的屬性:1、[UIScreen
Time of Update: 2013-12-10
1 前言使用UITapGestureRecognizer 監聽捕獲使用者點擊了螢幕的事件。2 代碼執行個體ZYViewController.m [plain] (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from
Time of Update: 2013-12-10
1 前言使用 CGAffineTransformMakeRotation/CGContextRotateCTM函數來建立一個仿射旋轉變換。2 代碼執行個體ZYViewControllerView.m [plain] - (void)drawRect:(CGRect)rect{ /* Create the path first. Just the path handle. */