Time of Update: 2013-12-10
建立一個UITextView,預設啟動鍵盤,並將游標定位到首位置,因為UITextFiled類沒有此功能,所以改用UItextView.代碼如下:[cpp] UITextView *m_contentTextField = [[[UITextView alloc] init] autorelease]; m_contentTextField = [[[UITextView alloc] init] autorelease]; m_contentTextField.frame
Time of Update: 2013-12-10
(註:環境Mac OS X Lion 10.7.3 + Xcode 4.2.1 + iOS SDK 5.0.)比如工程中添加了一個UIViewController的sub class,建立的時候選中“With XIB for user interface”,則建立完成會同時產生三個檔案:xxx.h, xxx.m, xxx.xib(前期也可是*.nib,xib和nib都指UI源檔案,後來蘋果統一用xib尾碼名了)。xxx.h預設內容:#import
Time of Update: 2013-12-10
一、建立一個single view application類型的iOS
Time of Update: 2013-12-10
//添加鍵盤的監聽事件[[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotificationobject:nil]; #pragma mark 滾動scrollview 使被隱藏的textfield顯示在螢幕正確的位置(軟鍵盤的上方)-
Time of Update: 2013-12-10
-(IBAction)openMaps { // Where is Apple on the map anyway? NSString* addressText = @"1 Infinite Loop, Cupertino, CA 95014"; // URL encode the spaces addressText =
Time of Update: 2013-12-10
1.換顏色 CGRect frame = CGRectMake(0, 0, 320, 47);UIView *v = [[UIView alloc] initWithFrame:frame];UIColor *c = [[UIColoralloc] initWithRed:0.4green:0.7blue:0.3alpha:1.0]; v.backgroundColor =
Time of Update: 2013-12-10
-(UIView *)findView:(UIView *)aView withName:(NSString *)name{ Class cl = [aView class]; NSString *desc = [cl description]; if ([name
Time of Update: 2013-12-10
#import <AssetsLibrary/AssetsLibrary.h>-(void)getImgs{ dispatch_async(dispatch_get_main_queue(), ^{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; &
Time of Update: 2013-12-10
1.標頭檔#import <Foundation/Foundation.h>typedef enum VerticalAlignment { VerticalAlignmentTop, VerticalAlignmentMiddle, VerticalAlignmentBottom,} VerticalAlignment;@interface
Time of Update: 2013-12-10
在項目中我希望頁面跳轉有不同的動畫效果,我是一個喜歡將公用代碼提交出來寫成工具類的人,這個當然也不會放過,好了,看代碼:.h檔案:[cpp]#import <Foundation/Foundation.h> #import <QuartzCore/QuartzCore.h> @interface MyAnimationUtil : NSObject
Time of Update: 2013-12-10
-(void)setRefreshWindow{ CGRect frame = CGRectMake(0.0, 0.0, 320.0, 20.0); statusbarWindow = [[UIWindow alloc] initWithFrame:frame]; [statusbarWindow setBackgroundColor:[UIColor
Time of Update: 2013-12-10
1、顯示映像: CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 109.0f);UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];[myImage setImage:[UIImage imageNamed:@"myImage.png"]];myImage.opaque =
Time of Update: 2013-12-10
最近這個項目在用ARC,在追蹤記憶體的時候,發現記憶體不對。這樣的情況下就不會調用dealloc方法:@interface Obj1 : NSObject { Obj2 *obj2; } @interface Obj2 : NSObject { } @implementation
Time of Update: 2013-12-10
NSString *dateStr=[dic objectForKey:@"date"];// 2012-05-17 11:23:23 NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; NSUInteger unitFlags =
Time of Update: 2013-11-16
源碼地址:https://github.com/thermogl/TISpringLoadedViews,這個比較複雜,我寫了個簡化版的:https://www.dropbox.com/s/sv3yhm8dovh0adq/SpringDemo.zip- ()simulateSpringWithDisplayLink:(CADisplayLink * (springEnabled && != CGPointMake(self.center.x -- CGPoint
Time of Update: 2013-11-16
使用SQLite資料庫建立資料庫建立資料庫過程需要3個步驟:1、使用sqlite3_open函數開啟資料庫;2、使用sqlite3_exec函數執行Create Table語句,建立資料庫表;3、使用sqlite3_close函數釋放資源。 這個過程中使用了3個SQLite3函數,它們都是純C語言函數,通過Objective-C去調用C函數當然不是什麼問題,但是也要注意Objective-C資料類型與C資料類型相容性問題。下
Time of Update: 2013-11-16
"language" ="english";"language" ="中文"; NSLog(@"%@",NSLocalizedString(@"language",
Time of Update: 2013-11-16
一、Android 環境搭建1、安裝Andriod-NDK(Native Development
Time of Update: 2013-11-16
轉載自:liubo0_0的專欄 連結網址:http://blog.csdn.net/liubo0_0/article/details/7085935在 UIView 中有一個autoresizingMask的屬性,它對應的是一個枚舉的值(如下),屬性的意思就是自動調整子控制項與父控制項中間的位置,寬高。enum {
Time of Update: 2013-11-16
以前在cocos2d-x項目中用到json解析,整合了libjson庫後發現網上提供的解析方法大多是在解析過程中取得值,並沒有將解析結果有效儲存起來,於是摸索一番,把解析結果根據資料格式存到數組或字典當中。 不敢獨享,代碼奉上: JsonUtil:: parseArrJSON(JSONNODE *n,CCObject ** (n == isAry= JSONNODE_ITERATOR it = *key=json_name(* (strcmp(key, )==