我使用AVCaptureSession创建了一个相机.我已经为照片和视频录制模式配置了它.
相机和应用程序运行正常.此外,我还允许播放背景音乐 (如果用户在iPhone中使用音乐应用程序播放歌曲),同时打开相机或录制视频.它也工作正常.(附图2)
我借助此代码允许背景音乐播放
AVAudioSession *session1 = [AVAudioSession sharedInstance];
[session1 setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers|AVAudioSessionCategoryOptionDefaultToSpeaker|AVAudioSessionCategoryOptionAllowBluetooth error:nil];
[session1 setActive:YES error:nil];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
Run Code Online (Sandbox Code Playgroud)
现在,如果我接到一个电话,通过点击主页按钮并打开应用程序来最小化电话呼叫屏幕并想要打开相机屏幕来捕获图像/录制视频,它会打开但冻结图像(附加图像(1)).
现在我的要求是,我想在通话时捕捉图像/录制视频.我寻找了另一个应用程序,Snapchat正在做同样的事情,我可以在通话时录制视频.
我正在创建一个管理图像视图的alpha属性的应用程序.当用户移动手机时,alpha属性增加/减少.我在这里看到了关于使用UIAccelerometer的子类的一些信息.任何人都可以帮我这样做,以便我可以在模拟器上测试它.谢谢
可能重复的iPhone:AVCaptureSession捕获输出崩溃(AVCaptureVideoDataOutput)
我创建了一个带有自定义相机的应用程序,用于视频录制.通过使用AVCaptureSession和AVCaptureVideoDataOutput,我得到了录制的视频文件.对于IOS 6和更低版本,每件事都可以正常工作.但当我在设备上运行相同的应用程序与IOS7应用程序崩溃同时解决相机类与此问题...
thread #1: tid = 0x7994, 0x3b1eab26 libobjc.A.dylib`objc_msgSend + 6, stop reason = EXC_BAD_ACCESS (code=1, address=0x7000000c)
frame #0: 0x3b1eab26 libobjc.A.dylib`objc_msgSend + 6
frame #1: 0x2fa46654 AVFoundation`-[AVCaptureVideoDataOutput _applyOverridesToCaptureOptions:] + 172
frame #2: 0x3387b050 UIKit` stub helpers + 27224
Run Code Online (Sandbox Code Playgroud)
我用来设置视频数据输出的代码 -
[_captureSession beginConfiguration];
if([_captureSession canAddInput:_captureDeviceInputAudio])
[_captureSession addInput:_captureDeviceInputAudio];
_captureOutputAudio = [[AVCaptureAudioDataOutput alloc] init] ;
if([_captureSession canAddOutput:_captureOutputAudio])
[_captureSession addOutput:_captureOutputAudio];
_captureDeviceVideo = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
_captureDeviceInputVideo = [AVCaptureDeviceInput deviceInputWithDevice:_captureDeviceVideo error:&error];
if([_captureSession canAddInput:_captureDeviceInputVideo])
[_captureSession addInput:_captureDeviceInputVideo];
_captureOutputVideo = [[AVCaptureVideoDataOutput alloc] init] ;
if([_captureSession canAddOutput:_captureOutputVideo])
[_captureSession …Run Code Online (Sandbox Code Playgroud) 我正在研究Firebase项目,我在其中将用户信息存储在表中。现在,我的要求是在表中显示所有用户。这是我的数据库快照
我可以使用从数据库中获取所有用户
if let user = FIRAuth.auth()?.currentUser {
self.ref?.child("Users").observeSingleEvent(of: .value, with: { (snapshot) in
// Get user value
let value = snapshot.value as? NSDictionary
let name = value?["name"] as? String ?? ""
let email = value?["email"] as? String ?? ""
// ...
}) { (error) in
print(error.localizedDescription)
}
}
Run Code Online (Sandbox Code Playgroud)
上面的代码向我返回了包含bod,电子邮件,姓名,性别的用户数组。但是我只想获取电子邮件和用户名。 有没有一种方法只能从数据库中获取指定的字段?
ios firebase swift firebase-authentication firebase-realtime-database
我正在开发一个BLE项目,因为我启动了CBCentralManager,并扫描可用的设备.我能够扫描并连接可用的BLE外围设备.一切正常,直到我没有在iOS 11.0.x版本上测试过.
当我在iOS 11.1.1或11.1.2上测试时,CBCentralManager总是在启动应用程序时返回我的poweredOff状态.但是,当我打开控制中心,关闭并再次打开蓝牙或激活/停用FlightMode(自动关闭/开启蓝牙).应用程序开始扫描BLE外围设备,一切看起来都很好,直到重新启动app.有没有人在iOS 11.1.x上遇到这样的问题并能够解决这个问题,请帮助解决这个问题.
下面是我检查状态的代码
func initiateCentralManager(){
manager = CBCentralManager(delegate: self, queue: nil, options: [CBCentralManagerOptionRestoreIdentifierKey : "MyBLECurrentState"])
}
func centralManagerDidUpdateState(_ central: CBCentralManager){
print("Received CBCentralManager state")
peripheralArray.removeAll()
if central.state == .poweredOn {
print("poweredOn")
} else if central.state == .poweredOff {
print("poweredOff")
}
}
Run Code Online (Sandbox Code Playgroud) 我想在鼠标右键和左键上创建一个动作.点击可能在NSTableViewCell,NSView等上(就像当我们右键单击窗口时它会弹出一个弹出窗口).有没有API来完成这样的任务?如果不是,任何其他方式.提前谢谢你的帮助.
我正在开发一个与更改图像颜色效果相关的应用程序.我做了几乎所有事情.现在的问题是,在其中一个效果我必须像photoshop中的发光egdes滤镜一样生效.此滤镜使图像边缘的颜色和其余图像颜色为黑色.通过使用BradLarson GPU Image GPUImageSobelEdgeDetectionFilter或GPUImageCannyEdgeDetectionFilter我可以找到边缘但是有白色边缘,我需要找到颜色边缘.是他们通过使用GPUImage或openCV找到颜色边缘的任何其他方法.任何帮助对我都很有帮助.谢谢
我正在尝试构建一个类似附加圆形图像的控件,其中多个段的每个部分的空间相等。段数可以根据提供的数组而改变。
到目前为止,我已经使用 CAShapeLayer 和 UIBezierPath 开发了这个。还在每个形状图层的中心添加了文本。到目前为止,我已经添加了用于生成此控件的代码。
let circleLayer = CALayer()
func createCircle(_ titleArray:[String]) {
update(bounds: bounds, titleArray: titleArray)
containerView.layer.addSublayer(circleRenderer.circleLayer)
}
func update(bounds: CGRect, titleArray: [String]) {
let position = CGPoint(x: bounds.width / 2.0, y: bounds.height / 2.0)
circleLayer.position = position
circleLayer.bounds = bounds
update(titleArray: titles)
}
func update(titleArray: [String]) {
let center = CGPoint(x: circleLayer.bounds.size.width / 2.0, y: circleLayer.bounds.size.height / 2.0)
let radius:CGFloat = min(circleLayer.bounds.size.width, circleLayer.bounds.size.height) / 2
let segmentSize = CGFloat((Double.pi*2) / Double(titleArray.count))
for i in 0..<titleArray.count {
let …Run Code Online (Sandbox Code Playgroud) ios ×5
objective-c ×4
iphone ×3
swift ×3
bluetooth ×1
cashapelayer ×1
catextlayer ×1
cocoa ×1
firebase ×1
gpuimage ×1
ios11.1.1 ×1
ios5 ×1
ios7 ×1
iphone-5 ×1
macos ×1
nsview ×1
nswindow ×1
opencv ×1
quartz-core ×1