iphone - using NSInvocation: constant value

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-03-09T01:20:13Z Indexed on 2010/03/09 1:21 UTC
Read the original article Hit count: 346

Filed under:
|
|
|

I am dealing with an old iPhone OS 2.x project and I want to keep compatibility, while designing for 3.x.

I am using NSInvocation, is a code like this

NSInvocation* invoc = [NSInvocation invocationWithMethodSignature:
       [cell methodSignatureForSelector:
                                    @selector(initWithStyle:reuseIdentifier:)]];
[invoc setTarget:cell];
[invoc setSelector:@selector(initWithStyle:reuseIdentifier:)];
int arg2 = UITableViewCellStyleDefault;  //????
[invoc setArgument:&arg2 atIndex:2];
[invoc setArgument:&identificadorNormal atIndex:3];
[invoc invoke];

to call 3.0 APIs on 2.0.

I am having a problem on the line I marked with question marks.

The problem there is that I am trying to assing to arg2, a constant that has not been defined in OS 2.0. As everything with NSInvocation is to do stuff indirectly to avoid compiler errors, how do I set this constant to a variable in an indirect way? Some sort of performSelector "assign value to variable"...

is that possible? thanks for any help.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk-3.0