Develop
2015.02.10 12:56
[ios] 문자열로 함수 실행하기 (eval 함수처럼)
조회 수 861 댓글 0
원형은..
NSSelectorFromString(<#NSString *Selector Name#>)
해당 함수(메소드)의 유효성을 확인하는 코드
SEL selector = NSSelectorFromString(@"placeToDownWithPos:shipSize:"); if ([self respondsToSelector:selector]) { NSLog(@"respondsToSelector"); }
실행까지는 이렇게 하면 됨 ㅋㅋ
NSString *methodString = @"agreeOmClause"; SEL selector = NSSelectorFromString(methodString); if ([self respondsToSelector:selector]) { [self performSelector:selector withObject:nil afterDelay:0.0]; }
[출처] http://stackoverflow.com/questions/22585912/nsselectorfromstring-does-not-work
-
[ios] 비동기 블럭 코드 예제
-
[kotlin] 코틀린 안드로이드 앱 버전/빌드 정보
-
[ios] GMT Date와 Local Date 변환하기
-
[c] 이진 탐색 두 가지 코드 (재귀/반복)
-
[ios] NSString, RegularExpression Find/Replace
-
[ios] URL 랜딩 속도(OpenURL 10초 정지되는) 이슈
-
[ios] Thread Loop 내에서 UI 업데이트 방법
-
[android] AlertDialog 메시지 창 띄우기
-
[ios] 문자열로 함수 실행하기 (eval 함수처럼)
-
[ios] 아이폰 앱 이름 및 버전 정보
-
[android] N-Puzzle 게임
-
XE Core 1.8.18 본문 작성시 태그(html) 사라지는 버그