我正在开发相机应用程序。我使用了一个按钮来在需要时打开和关闭闪光灯模式。此方法非常适用于捕获静止图像,不适用于视频模式。下面是我的代码,请帮忙。TIA
class func setFlashMode(_ flashMode: AVCaptureFlashMode, for device: AVCaptureDevice) {
if device.hasFlash && device.isFlashModeSupported(flashMode) {
do {
try device.lockForConfiguration()
device.flashMode = flashMode
device.unlockForConfiguration()
}
catch
{
print("Error:-\(error)")
}
}
}
Run Code Online (Sandbox Code Playgroud)
Flash 按钮操作
@IBAction func flashButtonClicked(_ sender: UIButton)
{
sender.isSelected = !sender.isSelected
if !(sender.isSelected)
{
sender.setTitle(NSLocalizedString("OFF", comment: ""), for: UIControlState.normal)
CameraVC.setFlashMode(AVCaptureFlashMode.off, for: self.videoDeviceInput.device)
}
else
{
sender.setTitle(NSLocalizedString("ON", comment: ""), for: UIControlState.normal)
CameraVC.setFlashMode(AVCaptureFlashMode.on, for: self.videoDeviceInput.device)
}
}
Run Code Online (Sandbox Code Playgroud)
视频按钮操作
@IBAction func videoButtonClicked(_ sender: UIButton)
{
self.sessionQueue.async {
if !self.movieFileOutput.isRecording
{
if UIDevice.current.isMultitaskingSupported
{ …Run Code Online (Sandbox Code Playgroud) 如果导航到iPhone的手机应用程序,然后转到联系人 - >信息(在任何联系人上)..您将在联系人的底部看到在同一行上有两个相邻的UITableViewCell.在这种特殊情况下,它们是"短信"和"添加到收藏夹"
这种布局是如何实现的?如果那里有任何例子,那将是伟大的.
我正在开发一个iPhone应用程序,但发现我需要另一个视图/窗口让用户输入并保存数据/信息.
如何添加其他视图?我是否在界面构建器中添加它,然后将其链接到主应用程序委托中,或者它是否有自己的.h和.m文件.
我选择了一个窗口视图应用程序开始,我是否需要从翻转侧视图应用程序重新开始,或者如果我在那里有正确的代码,这只是添加.
曼尼谢谢
卡尔
我正在设计一个搜索栏。我需要搜索栏看起来像图像中的一个。尝试了几种方法,但没有改变。非常感谢帮助。

[已编辑] 使用 Richard 的代码后查看图像,它看起来像这样。我希望灰色是清晰的。

在iPhone上加载包含游戏级别地图的静态数据文件的最佳方法是什么?我已经看到一些使用XML文件,但在我的情况下这似乎有点过分,因为数据文件只是决定了游戏级别的布局,即障碍物的位置.另外,它们应该存储在哪个项目目录中?
提前致谢!
我知道有可能使用越狱的iPhone,但Apple是否提供任何用于为主要移动桌面界面/背景设置皮肤的API?
我有这款Thermal Bluetooth Printer Impress +。我正在制作应打印账单的自定义应用程序。我已经编写了将其连接到iPhone的代码,但是它从未出现在搜索中。它从未达到didDiscoverPeripheral。我不知道怎么了 以下是我用于搜索蓝牙设备的代码。请帮忙。任何帮助将不胜感激。
import UIKit
import CoreBluetooth
class ViewController: UIViewController, CBCentralManagerDelegate, CBPeripheralDelegate {
var centralManager: CBCentralManager!
var peripheral: CBPeripheral!
var writeCharacteristic: CBCharacteristic!
var service: CBService!
var characteristic: CBCharacteristic!
var bluetoothAvailable = false
let message = "1"
@IBOutlet weak var labelDeviceName: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
centralManager = CBCentralManager(delegate: self, queue: nil)
}
func centralManagerDidUpdateState(_ central: CBCentralManager)
{
print("Checking state")
switch (central.state)
{
case .poweredOff:
print("CoreBluetooth BLE hardware is powered off")
case .poweredOn:
print("CoreBluetooth BLE hardware …Run Code Online (Sandbox Code Playgroud) 我正在开发一个项目,该项目将在 Web 视图中显示一个网站,该网站的设计将 iPhone 置于上下文中,并且只有一个 URL,所有检查都在服务器上完成。我有一个屏幕,上面有一些文字,例如“年龄”。对于这个特定页面,我想添加一个标签栏按钮来共享应用程序。
ios ×7
objective-c ×5
cocoa-touch ×4
iphone ×4
bluetooth ×1
camera-flash ×1
ios-camera ×1
printing ×1
swift ×1
swift2 ×1
swift3 ×1
uisearchbar ×1
uitableview ×1
webkit ×1
wkwebview ×1
xcode ×1