質問

I am trying to define a protocol method without adding parameters but couldn't find the correct syntax.

Here is the definition (it has a syntax error)

- (void)cameraOverlayView:(CameraOverlayView *)cameraOverlay didTakePhoto;

I don't want to pass any values with the second parameter. My aim is only to signal that something happened to the delegate instance.

How should I write the definition?

役に立ちましたか?

解決 2

- (void)cameraOverlayViewDidTakePhoto:(CameraOverlayView *)cameraOverlay;

他のヒント

Your the second part of the method is not formatted correctly:

- (void)cameraOverlayView:(CameraOverlayView *)cameraOverlay didTakePhoto;

Because of the space, it's expecting a parameter. Instead, work the didTakePhoto part into the method name, like:

- (void)cameraOverlayViewDidTakePhoto:(CameraOverlayView *)cameraOverlay;

basically in objective c you can't have method name parts dangling after parameters... so:

illegal:

-(void)methodWith:(int)theInt forMyMom;

normal:

-(void)methodForMyMomWithInt:(int)theInt;

legal but strange

-(void)method:(int)theInt :(int)theOtherInt;

with the selector: @selector(method::)

This is an issue of Objective-C convention. You could rewrite it as:

- (void)cameraOverlayView:(CameraOverlayView *)cameraOverlayViewDidTakePhoto;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top