小编Tan*_*yem的帖子

PWA应用程序 - 使用Angular 6将图像和视频存储在本地存储中

我正在使用角度javascript创建一个Progressive Web应用程序(PWA).我需要存储从服务器下载的图像和视频.

我已经探讨了本地存储和IndexedDb,两者都有存储大小的限制.官方文档称,Safari浏览器最多分配50 MB,Chrome mobile 为本地存储分配6%的可用磁盘空间.

是否有任何选项可以在本地存储大尺寸的图像和视频,并在设备处于脱机状态时在PWA应用程序中显示相同的内容?

ios progressive-web-apps angular angular6 pwa

8
推荐指数
1
解决办法
1266
查看次数

react-native - 检测手指移动到视图中

我正在研究如何在 React Native 中检测手指移动到视图中。例如,我在屏幕中有一个视图。我的手指按在视图外,然后慢慢移动到视图。当手指越过边界时,视图可以识别我的手指。

我研究了Gesture ResponderPanResponder。但是我发现的所有示例都涉及视图并移动它。

如果您有办法或示例代码来执行我上面所说的操作,请告诉我。

我需要做一些数学计算才能到达目的地吗?

先感谢您!

android uigesturerecognizer ios uipangesturerecognizer react-native

7
推荐指数
1
解决办法
515
查看次数

如何在AR应用程序中包含和运行图像跟踪配置和世界跟踪配置

我正在体验ARkit,并在线观看了一些教程,我知道如何进行图像跟踪和世界跟踪,但是当相机跟踪图像时,不知道如何将它们组合到同一个应用程序中,设备会自动运行图像跟踪配置,但当图像离开相机时,它运行世界跟踪配置.

我知道我也可以使用世界跟踪来跟踪图像,但图像跟踪配置似乎具有更稳定的跟踪结果.

有人可以帮忙吗?

iphone ios swift arkit

4
推荐指数
1
解决办法
1480
查看次数

CMSampleBufferGetImageBuffer(sampleBuffer)返回nil

我使用此代码从摄像机捕获视频,但是CMSampleBufferGetImageBuffer(sampleBuffer)始终返回nil。问题是什么?。这是代码,我修改了源代码以适应Swift 4 https://github.com/FlexMonkey/CoreImageHelpers/blob/master/CoreImageHelpers/coreImageHelpers/CameraCaptureHelper.swift

import AVFoundation
import CoreMedia
import CoreImage
import UIKit


class CameraCaptureHelper: NSObject
{
let captureSession = AVCaptureSession()
let cameraPosition: AVCaptureDevice.Position

weak var delegate: CameraCaptureHelperDelegate?

required init(cameraPosition: AVCaptureDevice.Position)
{
    self.cameraPosition = cameraPosition

    super.init()

    initialiseCaptureSession()
}

fileprivate func initialiseCaptureSession()
{
    captureSession.sessionPreset = AVCaptureSession.Preset.photo

    guard let camera = AVCaptureDevice.default(.builtInWideAngleCamera,
                                               for: .video, position: cameraPosition)
        else {
            fatalError("Unable to access camera")
    }
    do
    {
        let input = try AVCaptureDeviceInput(device: camera)

        captureSession.addInput(input)
    }
    catch
    {
        fatalError("Unable to access back camera")
    }

    let videoOutput = …
Run Code Online (Sandbox Code Playgroud)

avfoundation core-media ios swift

3
推荐指数
1
解决办法
416
查看次数

带有2个数据源/代表的iOS Tableview

是否可以在视图控制器上使用2个不同的数据源控制桌面视图?我希望视图上的表显示不同的表数据,具体取决于用户选择的段控制按钮.在当前状态下,似乎数据源始终是最后声明的选项.在这种情况下,missedEventLogController.我是否需要在视图中的当前表格上放置另一个相同的表格?

    @IBOutlet weak var eventLog: UITableView!
    @IBOutlet weak var missedEventLog: UITableView!
 override func viewDidLoad() {
        self.eventLog.delegate = eventLogTableController
        self.eventLog.dataSource = eventLogTableController
        eventLog.reloadData()

        self.missedEventLog.delegate = missedEventLogController
        self.missedEventLog.dataSource = missedEventLogController
Run Code Online (Sandbox Code Playgroud)

delegates datasource uitableview ios swift

2
推荐指数
1
解决办法
311
查看次数

用于按钮触摸事件的自定义 UIButton 类

是否可以创建一个带有触摸事件动画的自定义 UIButton 类,每次用户触摸按钮时都会自动调用该动画?

 import UIKit

 class AnimatedButton: UIButton {

     @objc private func buttonClicked(sender: UIButton) {

              UIView.animate(withDuration: 0.5,
                             delay: 1.0,
                             usingSpringWithDamping: 1.0,
                             initialSpringVelocity: 0.2,
                             options:  .curveEaseOut,
                             animations: {
                                 //do animation
                                 sender.transform = CGAffineTransform(scaleX: 0.6, y: 0.6)
                             },
                             completion: nil)

     }
  }
Run Code Online (Sandbox Code Playgroud)

所以我不想在必须调用 button.buttonTouched() 的 ViewController 中创建一个动作。每次我在所有 UIButton 中使用此类时,这都应该自动发生。

有没有可能做这样的事情?

uibutton uiviewanimation ios swift

2
推荐指数
1
解决办法
2028
查看次数

从表格视图单元格中收集文本字段文本(Swift)

我有一个表格视图,每个单元格中都有一个文本字段。我添加了这样的目标:

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "customLevelCell") as! LevelTableViewCell

    cell.cellTextField.addTarget(self, action: #selector(ViewController.TextfieldEditAction), for: .editingDidEnd)

    return cell
}
Run Code Online (Sandbox Code Playgroud)

但发现我无法使用indexpath.row / sender.tag来获取特定的文本字段文本

@objc func TextfieldEditAction(sender: UIButton) {
}
Run Code Online (Sandbox Code Playgroud)

所以我的问题是如何在用户编辑文本字段之一后获取文本。

另外,我如何获取将用于收集它们添加到特定文本字段的文本的indexpath.row或sender.tag。

uitableview ios swift

0
推荐指数
1
解决办法
1684
查看次数