dimanche 21 septembre 2014

Objecrtive C, overloading enum and float


Vote count:

0




I created the following category methods :



@implementation UIView (Snapshot)

enum ScaleType {FullScreen, RealSize};

- (UIImage *)captureSnapshot:(float)scale
{
...
}

- (UIImage *)captureSnapshot:(enum ScaleType)scaleType
{
switch (scaleType) {
case FullScreen:
return [self captureSnapshot: 0.0f];
break;

case RealSize:
return [self captureSnapshot: 1.0f];
break;

default:
...
}
}

@end


This code does not compile with the error : "Duplicate declaration of method 'captureSnapshot:' What is the right way to do this ?



asked 2 mins ago







Objecrtive C, overloading enum and float

Aucun commentaire:

Enregistrer un commentaire