Develop
2015.02.10 12:56
[ios] 문자열로 함수 실행하기 (eval 함수처럼)
조회 수 860 댓글 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
-
[c] 파일명 또는 특정 패턴을 적용
-
[Android Error] The number of method references in a .dex file cannot exceed 64K
-
[linux] CentOS Apache 웹서버에 HTTPS 적용
-
[macos] How to Fix ‘You Shut Down Your Computer Because of a Problem’
-
[io] Apple Watch, Today Extension 앱ID 설정
-
OCB5 Injection 앗싸뵹! ㅋㅋ
-
[linux] The Ultimate Wget Download Guide With 15 Awesome Examples
-
[js] e.stopPropagation() VS e.preventDefault ()
-
[c] 기막힌 정렬 코드 ㅋㄷ
-
[android] 초간단 얼럿 (AlertDialog)
-
사이버보안실무 수업 메모
-
[ios] 비동기 블럭 코드 예제