Xcode 版本 8.2 (8C38)
有没有办法检测 UITests 是否在真实设备上运行?
谢谢
这是我在一个按钮内编码的内容UITableViewCell.
var shareAlert = UIAlertController(title: "Post Alert",
message: "Your Post has been Shared with your Friends",
preferredStyle: UIAlertControllerStyle.Alert)
var Ok = UIAlertAction(title: "Ok",
style: UIAlertActionStyle.Default,
handler: nil)
shareAlert.addAction(Ok)
shareAlert.presentViewController(shareAlert, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
当用户单击按钮时,我希望它显示此警报,但是一旦我单击按钮,应用程序就会崩溃.我做错了吗?如何从按钮中显示警报视图UITableViewCell?
UIView animateWithDuration 的文档说在动画期间所有用户交互都被阻止。但我想知道它是否也会在预动画延迟期间阻塞。
该文件说:
“在动画过程中,正在动画的视图的用户交互被暂时禁用。(在 iOS 5 之前,整个应用程序的用户交互被禁用。)如果您希望用户能够与视图交互,请将 UIViewAnimationOptionAllowUserInteraction 常量包含在选项参数。”
但是当我给出明显的延迟(假设是 1 秒)时,它也会在那一秒内阻止 UI。我不认为是这种情况,因为延迟参数的文档说:
“在开始动画之前等待的时间(以秒为单位)。指定值 0 以立即开始动画。”
关键词有前开始的动画,而有关阻止有关用户交互的会谈笔记动画中。
但是,我的应用程序在预动画延迟期间不会更新 UI。延迟是否也会阻止 UI 交互,或者我的 UI 是否因其他原因被阻止?
如果可能的话,我想让用户能够完全绕过手表应用程序.
我已经尝试在我的ViewController上导入ClockKit来创建一个实例 CLKComplicationServer.我得到"没有这样的模块"错误.
有没有办法直接与iOS应用程序的复杂功能进行通信?
在我的单元测试中,有一个页面询问许可证使用库。运行我的单元测试时,即使我的所有单元测试都已完成,此权限对话框也会出现在屏幕上,并且不会消失。当UI测试尝试运行时,它们不会导致此对话框。有什么方法可以在单元测试之前运行UI测试?
在我的应用程序中,我想添加本地通知.方案是用户可以选择从周一到周日的任何时间和日期.例如,如果用户选择Mon,Thur和Sat作为日期和时间为晚上11:00,那么现在应该在所有选定的日期和特定时间通知用户.
码:
let notification = UNMutableNotificationContent()
notification.title = "Danger Will Robinson"
notification.subtitle = "Something This Way Comes"
notification.body = "I need to tell you something, but first read this."
let notificationTrigger = UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: true)
// let test = UNCalendarNotificationTrigger()
let request = UNNotificationRequest(identifier: "notification1", content: notification, trigger: notificationTrigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
Run Code Online (Sandbox Code Playgroud)
我正在使用此代码,但这不符合我的需要.
在UI测试上的Xcode 9.0(9A235),与之交互UISlider与adjust(toNormalizedSliderPosition:)时不工作在所有UISlider嵌套在UITableViewCell。
我已经在许多不同的场景中进行了测试: - Normal UISliders 没有嵌入到UITableView使用该adjust方法的工作中。-UISlider与 a 共存UITableView但不在 Table View Cell 内继续使用adjust
-UISlider在 aUITableView中可以唯一标识。-UISlider在 a 中识别UITableView可以响应简单的事件,例如tap()
-UISlider在 aUITableView中识别根本不适用于adjust方法,即使我将行数修改为 1。错误消息是:
获取元素 pid 的属性失败:24415,elementOrHash.elementID:106102876671744.43:错误域=XCTDaemonErrorDomain 代码=13“获取属性 5011 的值返回 AX 错误 -25205。” UserInfo={NSLocalizedDescription=获取属性 5011 的值返回 AX 错误 -25205。}
我在网上找到的相关讨论:https : //forums.developer.apple.com/thread/77445
我已经就此向 …
在早期的日子里,每当我想那里获取数据并不需要添加NSAppTransportSecurity设置NSAllowsArbitraryLoads关键YES的info.plist,但如果你现在要运行你的应用程序通过网络,那么它必须加入.
为什么需要它?它有用吗?它的用途是什么?
有人可以帮忙吗?
我的目标是UIRefreshControl用Lottie动画替换默认的微调框。
我的问题是,当我下拉UICollectionView子视图为的子视图时,动画无法立即播放UIRefreshControl。仅当我稍微向下滚动并暂停手指时,动画才会播放。当我再次开始移动滚动位置时,它立即返回到其初始播放状态,不再播放。
任何指导将不胜感激,以下是相关代码。
func setupRefreshControl() {
guard let refreshContents = Bundle.main.loadNibNamed("RefreshControlView", owner: self, options: nil), let refreshView = refreshContents[0] as? RefreshControlView else { return }
refreshView.frame = refreshControl.frame
refreshControl.addSubview(refreshView)
refreshControl.tintColor = UIColor.clear
refreshControl.backgroundColor = UIColor.clear
refreshControl.addTarget(self, action: #selector(exampleFunction), for: .valueChanged)
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
for subview in refreshControl.subviews {
if let refreshControlView = subview as? RefreshControlView {
refreshControlView.activityIndicatorControl.animationView.setAnimation(named: "lottieJson")
refreshControlView.activityIndicatorControl.animationView.loopAnimation = true
refreshControlView.activityIndicatorControl.animationView.play()
break
} else {
continue
}
}
}
Run Code Online (Sandbox Code Playgroud) ios ×6
swift ×3
xcode ×2
apple-watch ×1
info.plist ×1
lottie ×1
objective-c ×1
swift3 ×1
tableview ×1
uislider ×1
uitableview ×1
uiview ×1
uiwebview ×1
watchos-2 ×1