let location = CLLocationCoordinate2D(latitude: 32.075300, longitude: 34.782563)
@IBAction func DirectionsTolocationButton(_ sender: Any) {
// Create the AlertController and add its actions like button in ActionSheet
let ActionSheet = UIAlertController(title: "Please Select A Navigation Service.", message: nil, preferredStyle: .actionSheet)
let AppleMapsButton = UIAlertAction(title: "Apple Maps", style: .default) { action -> Void in
let destinationName = (self.barNameTemplate )
self.openMapsAppWithDirections(to: self.CoordinatesTemplate, destinationName: destinationName)
print("Apple Map Chosen!")
}
let WazeButton = UIAlertAction(title: "Waze", style: .default) { action -> Void in
func openWaze(location : CLLocationCoordinate2D) …Run Code Online (Sandbox Code Playgroud) 如何使用前置摄像头镜像修复捕获图像?SnapChat 似乎可以修复它以及 WhatsApp 和 Instagram,我该怎么办?我真的很想为此找到解决方案......它很烦人......提前谢谢
我已经看到在从前置摄像头 iOS 5.0 捕获时总是看到镜像,但它翻转了后置摄像头和前置摄像头的图像,这并没有真正解决任何人的问题。如果有人能帮我弄清楚如何只翻转前置摄像头图像或任何其他很棒的解决方案!
import UIKit
import AVFoundation
@available(iOS 10.0, *)
class CameraViewController: UIViewController,AVCaptureVideoDataOutputSampleBufferDelegate {
let photoSettings = AVCapturePhotoSettings()
var audioPlayer = AVAudioPlayer()
var captureSession = AVCaptureSession()
var videoDeviceInput: AVCaptureDeviceInput!
var previewLayer = AVCaptureVideoPreviewLayer()
var frontCamera: Bool = false
var captureDevice:AVCaptureDevice!
var takePhoto = false
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
prepareCamera()
}
func prepareCamera() {
captureSession.sessionPreset = AVCaptureSessionPresetPhoto
if let availableDevices = AVCaptureDeviceDiscoverySession(deviceTypes: …Run Code Online (Sandbox Code Playgroud) 我正在尝试Waze使用自己的API在我的应用程序中实现导航:这里.
我想设置in custom coordinates,array
然后在这段代码中使用它们:
func navigate(toLatitude latitude: Double , longitude: Double) {
if UIApplication.shared.canOpenURL(URL(string: "waze://")!) {
// Waze is installed. Launch Waze and start navigation
let urlStr: String = "waze://?ll=\(latitude),\(longitude)&navigate=yes"
UIApplication.shared.openURL(URL(string: urlStr)!)
}
else {
// Waze is not installed. Launch AppStore to install Waze app
UIApplication.shared.openURL(URL(string: "http://itunes.apple.com/us/app/id323229106")!)
}
}
Run Code Online (Sandbox Code Playgroud)
我已尝试设置不同类型的阵列,但没有成功使其工作.所以,如果你可以帮我设置自定义数组,保持纬度和经度可以正常使用代码,这将是很棒的
你的帮助会非常有帮助,
先感谢您.
我正在尝试弄清楚如何使用AVFoundationSwift 录制视频。我已经创建了一个自定义相机,但我只知道如何用它拍摄静态照片,但不知道如何录制视频。希望你能帮我解决这个问题。
我想按住 takePhotoButton 录制视频,然后在我预览当前静态照片的地方预览视频。您的帮助将真正帮助我继续我的项目。多谢!
import UIKit
import AVFoundation
@available(iOS 10.0, *)
class CameraViewController: UIViewController,AVCaptureVideoDataOutputSampleBufferDelegate {
let photoSettings = AVCapturePhotoSettings()
var audioPlayer = AVAudioPlayer()
var captureSession = AVCaptureSession()
var videoDeviceInput: AVCaptureDeviceInput!
var previewLayer = AVCaptureVideoPreviewLayer()
var frontCamera: Bool = false
var captureDevice:AVCaptureDevice!
var takePhoto = false
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
prepareCamera()
}
func prepareCamera() {
captureSession.sessionPreset = AVCaptureSessionPresetPhoto
if let availableDevices = AVCaptureDeviceDiscoverySession(deviceTypes: [.builtInWideAngleCamera], mediaType: AVMediaTypeVideo, position: .back).devices { …Run Code Online (Sandbox Code Playgroud) ios ×5
swift ×5
avfoundation ×2
arrays ×1
camera ×1
coordinates ×1
function ×1
networking ×1
reachability ×1
uitableview ×1
video ×1
view ×1
waze ×1