tags:

views:

92

answers:

2

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
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
Correction noted. Selectors are different.
hotpaw2
+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