Time of Update: 2013-12-10
block 現在已經基本上已經使用非常普遍了,在使用用中也又很多坑,下面把block開發中應該知道的那幾件事總結下. :內聯(inline)Block內聯block 說白了就是block被嵌入到一個函數中例如:typedef void (^HelloBlock)(void); - (void) BlockTest{HelloBlock myBlock= ^(void){NSLog(@"Hello
Time of Update: 2013-12-10
本篇的目的是開發一個自訂的彈出交談視窗組件,就是上面圖6中半透明的資訊提示視窗,其實系統類別庫中已經有UIActionSheet、UIAlertView能做到這樣的功能組件,但是顯示外觀不怎麼美觀而且跟我的這個設計不怎麼配,同時這2個組件的外觀自訂性很差幾乎改變不了顯示外觀,所以決定自己開發一個組件。實現的思路是這樣的,做一個繼承自UIWindow組件的組件的對象,這樣這個組件也就是一個UIWindow瞭然後在這個UIWindow中添加相應的半透明View達到顯示效果的目的,當我們需要顯示快顯視
Time of Update: 2013-12-10
iOS裝置現在有三種不同的解析度:iPhone 320x480、iPhone 4 640x960、iPad 768x1024。以前程式的啟動畫面(圖片)只要準備一個 Default.png 就可以了,但是現在變得複雜多了。下面就是 CocoaChina 會員做得總結 如果一個程式,既支援iPhone又支援iPad,那麼它需要包含下面幾個圖片:Default-Portrait.png iPad專用豎向啟動畫面
Time of Update: 2013-12-10
I got an error in XCode 4 Issue Navigator,but in Log Navigator there is no error.After restart XCode,the error was erase.//************************************************************************************I had the same problem in XCode 4:
Time of Update: 2013-12-10
代碼: //選擇按鈕 NSArray *buttonNames = [NSArray arrayWithObjects:@"今天", @"本周", @"本月", nil]; UISegmentedControl* segmentedControl = [[UISegmentedControl alloc]
Time of Update: 2013-12-10
要支援裝置旋轉,要做如下工作: 重寫對應的View
Time of Update: 2013-12-10
Java代碼 最近在做使用者管理程式,在做的過程中使用者註冊資訊校正在網上查了好久,沒查到現成的代碼,只能自己寫了, 最近在做使用者管理程式,在做的過程中使用者註冊資訊校正在網上查了好久,沒查到現成的代碼,只能自己寫了,Java代碼 代碼放在這裡,有需要直接拿去。自己也做備份,以後使用方便。 代碼放在這裡,有需要直接拿去。自己也做備份,以後使用方便。Java代碼 //校正使用者名稱 + (
Time of Update: 2013-12-10
一.UIActionSheet(動作表) 和UIAlertView(警告) UIActionSheet用於迫使使用者在兩個或更多的選項之間進行選擇的模式視圖。動作表從螢幕底部彈出,顯示一系列按鈕供使用者選擇,使用者只有單擊一個按鈕後才能繼續使用應用程式。UIAlertView警告以藍色圓角矩形形式出現在螢幕中部,警報可顯示一個或多個按鈕為了讓控制器類充當動作表的委託,控制器需要遵從UIActionSheetDelegate協議 二.UIActionSheet(動作表)的建立&
Time of Update: 2013-12-10
昨天下午,同事用xcode4.2向appStore提交應用程式時,提示如下的錯誤:iPhone/iPod Touch: application executable is missing a required architecture. At least one of the following architecture(s) must be present: armv6如下:產生這個錯誤,很是疑惑,嘗試了幾個辦法,都失敗了,無奈之下,只好求助偉大的stackoverflow。解決辦法翻譯如下:
Time of Update: 2013-12-10
NSString 轉換成NSData 對象[cpp] NSData* xmlData = [@"testdata" dataUsingEncoding:NSUTF8StringEncoding]; NSData* xmlData = [@"testdata" dataUsingEncoding:NSUTF8StringEncoding];NSData 轉換成NSString對象[cpp] NSData *
Time of Update: 2013-12-10
在 NSDate中獲得時間資訊,年、月、星期、日、時、分、秒和毫秒:註:第一種方法不能擷取毫秒的資訊,最後利用第二種方法實現了擷取毫秒的資訊[cpp] NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSDate *now; NSDateComponents *comps = [[NSDateComponents
Time of Update: 2013-12-10
在網上找到了通過運行javascript指令碼得到網頁的html內容的方法:擷取所有html:[cpp] NSString *lJs = @"document.documentElement.innerHTML"; NSString *lJs = @"document.documentElement.innerHTML";擷取網頁title:[cpp] NSString *lJs2 =
Time of Update: 2013-12-10
xml字串為:<users><user name="hoge" age="20" /><user name="fuga" age="30" /></users> //解析按鈕事件-(IBAction)btnXml{ NSString* str= [uitextview1
Time of Update: 2013-12-10
NSString *URL =@"http://xxx.jpg"; NSData *imageData = [[NSDataalloc]initWithContentsOfURL:[NSURLURLWithString:URL]]; UIImage *image=[[UIImagealloc] initWithData:imageData]; [imgADBanner
Time of Update: 2013-12-10
//擷取檔案路徑 NSString *path = [[NSBundlemainBundle] pathForResource:@"user.plist"ofType:@""]; //擷取資料 NSMutableDictionary* dict = [ [ NSMutableDictionaryalloc ]
Time of Update: 2013-12-10
//asp.net中的web.config中,需要開啟get方式或者post方式<system.web> <webServices> <protocols> <add name="HttpSoap"> <add name="HttpPost"> <add name="HttpGet"> <add name=&
Time of Update: 2013-12-10
//建立檔案-(void)CreateFile:(NSString*)path fileName:(NSString*)filename{ //建立檔案管理工具 NSFileManager *fileManager = [NSFileManager defaultManager]; //更改到待操作的目錄下
Time of Update: 2013-12-10
:3秒切換到:建立一個基於視圖的項目,命名為Animation2,往項目中放入幾個圖片!!直接在Animation2ViewController.m中實現代碼: - (void)viewDidLoad { //定義數組,存放所有圖片對象 NSArray *images=[NSArray arrayWithObjects:[UIImage
Time of Update: 2013-12-10
首先建立一個基於視圖的項目,名字為ViewTest;在ViewTestViewController.m檔案viewDidLoad方法中寫上如下代碼:[cpp] //建立一個視圖UIView對象,擷取初始化螢幕大小,UIScreen mainScreen該裝置的內部螢幕,applicationFrame應用程式的螢幕面積幀點 UIView *view = [[UIView alloc]
Time of Update: 2013-12-10
用代碼建立處Segmentarray控制項,並設定它的一些屬性:[cpp] /*segmentarray.h*/ #import <UIKit/UIKit.h> @interface segmentarray : UIViewController { //建立控制項對象 UISegmentedControl