Anybody can tell me about Function pointer in iOS? Thanks :D
A:
If you are asking about the Objective C programming environment of iOS, Objective C is a pure superset of plain ANSI C. So function pointers work exactly the same as in C, and you can use them that same way in your iOS Objective C code.
Pointers to methods (selectors) are something somewhat different though.
hotpaw2
2010-08-27 15:18:06
A selector is emphatically not a pointer to a method. It's just a name. A pointer to a method *is* a function pointer.
Chuck
2010-08-27 15:37:45
Correction noted. Selectors are different.
hotpaw2
2010-08-27 22:58:34
+1
A:
If I understand properly what you are thinking of.
1. Like in C
void yourfunc() {}
foo(&yourfunc);
2. In Objective-C You can "refer" to a method using @selector and method sig
- (void) test:(NSInteger)n withTest:(BOOL)isTrue {}
[object performSelector:@selector(test:withTest:)];
F.Santoni
2010-08-27 15:23:08