2012年5月28日 星期一

Storyboard use in iOS

Storyboard feature only can use in up iOS5.0, The ARC feature also only use in up iOS5.0

Note :

1. The View controller in storyboard that need use a class file to handle it.

The class name need to connect to the storyboard view controller. ref up picture.


2.When return to up view can not use modal to recall original view controller. because the original view controller did not dismiss. that only be over view in this new view controller. so need to use method of

 [self dismissModalViewControllerAnimated:YES];
for return to original view controller.


3.The methods of view controller will can be used in new class for the UIViewController. you can find this method in the new files.



Other note is use for class use in iOS, if you use the method is -(void) ..... that is an instance classe method then when you want to use it that need to declare the class for an initial.



if you use the method is +(void)..... that is class method then when you want to use it that can direct to use [classname classmethod : parameters];  this is big difference from the instance class.

=== the global variable use in iOS that can not use static variable === 
=== the extern variable can not be used static in iOS                     === 


2012年5月15日 星期二

UTF8 Code use in Objective-C


//My Memo for UTF8 code in Objective-C
// How to use UTF8 中文字串 在 iOS


const static char *Word[] = {
    "一乙",
    "二力刀乃人匕又入了卜几丁
}



NSString *stringFromUTFString ;



stringFromUTFString = [[NSString alloc] initWithUTF8String:Word[1] ]; // load code to NSString
NSLog(@"%d" , stringFromUTFString.length  ); // 結果是 12 
    
for (int i = 0; i < stringFromUTFString.length; i++) {
        NSRange  strRange = NSMakeRange(i, 1); // i = index , 1 = range length
        NSString *subStr = [stringFromUTFString  substringWithRange:strRange];
        // subStr 結果是 @"二力刀乃人匕又入了卜几丁" one by one output     
        NSLog(@"%@" , subStr  );
}

2012年5月8日 星期二

android view的setVisibility方法值的意思


android view的setVisibility方法值的意思 

有三个值 visibility  One of VISIBLE, INVISIBLE, or GONE. 


imgBtn1.setVisibility(View.VISIBLE);

imgBtn1.setVisibility(View.INVISIBLE);

imgBtn1.setVisibility(View.GONE);

常量值为0,意思是可见的 

常量值为4,意思是不可见的 

常量值为8,意思是不可见的,而且不占用布局空间