Tag: void

空白后的未声明标识符

我得到了这个错误的线路,其中的void是它说sliderDidChange的未声明的标识符可以请一些人帮助我,我可以;find任何答案。 H。 文件 // // LightViewController.h // Flash Light // // Created by John Whitney on 12-07-27. // Copyright (c) 2012 Perfect Programs. All rights reserved. // #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @interface LightViewController : UIViewController { IBOutlet UISlider *slider; IBOutlet UISlider *theslider; IBOutlet UISlider *customslider; UIButton *onButton; UIButton *offButton; UIImageView *onView; UIImageView *offView; } @property(nonatomic, […]

返回函数内部无效

我正在尝试创build一个自定义类来点击图片。 在里面,我想创build一个返回一个UIImage的clickPicture函数。 但是, captureStillImageAsynchronously是一个void 。 我怎样才能返回从我收到的图像? 谢谢。 func clickPicture() -> UIImage? { if let videoConnection = stillImageOutput?.connection(withMediaType: AVMediaTypeVideo) { videoConnection.videoOrientation = .portrait stillImageOutput?.captureStillImageAsynchronously(from: videoConnection, completionHandler: { (sampleBuffer, error) -> Void in if sampleBuffer != nil { let imageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(sampleBuffer) let dataProvider = CGDataProvider(data: imageData!) let cgImageRef = CGImage(jpegDataProviderSource: dataProvider!, decode: nil, shouldInterpolate: true, intent: […]