typedef enum {
   UIReturnKeyDefault,
   UIReturnKeyGo,
   UIReturnKeyGoogle,
   UIReturnKeyJoin,
   UIReturnKeyNext,
   UIReturnKeyRoute,
   UIReturnKeySearch,
   UIReturnKeySend,
   UIReturnKeyYahoo,
   UIReturnKeyDone,
   UIReturnKeyEmergencyCall,
} UIReturnKeyType;


http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextInputTraits_Protocol/Reference/UITextInputTraits.html#//apple_ref/occ/intfp/UITextInputTraits/returnKeyType

Posted by tenn
,



ARC를 사용할때의 문제.


핸들러가 불릴때, 이미 인스턴스가 메모리에서 해제되면서 생기는 문제.

메모리에서 해제되지 않게 변수에 붙들어 매어두면 해결. (strong으로)




http://blog.f60k.com/arc_uibutton_exc_bad_access/

Posted by tenn
,




- (NSInteger)countStrWithEmoji:(NSString*)str {

    

    __block NSInteger cnt = 0;

    

    [str enumerateSubstringsInRange:NSMakeRange(0, [str length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:

     ^(NSString* substring, NSRange substringRange, NSRange enclosingRange, BOOL* stop){

         

         const unichar high = [substring characterAtIndex: 0];

         

         // surrogate pair

         if (0xd800 <= high && high <= 0xdbff) {

             cnt++;

             

             // not surrogate pair

         } else {

             cnt++;

         }

     }];

    

    return cnt;

}



Posted by tenn
,