我发现我UITableView无法在iOS 11中滚动,所以我在"cell for row"委托方法中做了一些测试:
cell.userInteractionEnabled为NO,滚动工作cell.contentView.userInteractionEnabled为NO,它没有我的自定义视图cell.contentView,所以我不知道如何解决它...
我在iOS 11中成功实现了AutoFill存储的用户名和密码建议
.我的登录视图控制器中有两个文本字段,一个用于电子邮件,一个用于密码.内容类型定义如下:

电子邮件/用户名文本字段配置

密码文本字段配置
这曾经在iOS 11中运行得很好,但在将我的开发iPad升级到iOS 12之后,该应用建议用户名字段的电子邮件,并在编辑密码字段时发生以下情况:

在我的创建帐户视图控制器中,我有3个文本字段:电子邮件,密码,重复密码.他们的内容模式设置如下:
minlength:8;minlength:8;编辑电子邮件地址字段时,它会正确建议电子邮件地址.但是,对于密码和重复密码字段,它建议存储密码,而不是建议新密码.
new password,并且创建帐户密码字段设置为password
none为登录和创建帐户字段,以便AutoFill可以尝试自动处理它
知道我需要更改什么,以便存储的用户名和密码建议再次在iOS 12中工作?
谢谢!
根据下面@kralex的要求,这是故事板中登录视图控制器的视图层次结构:

......并在设备上:

对于我的SwiftUI应用程序,我创建了一个简单的Title视图,该视图具有设置的字体大小和文本颜色。Title声明如下:
struct Title: View {
var string: String
var body: some View {
Text(string)
.font(.system(size: 32))
.color(Color.black)
}
}
Run Code Online (Sandbox Code Playgroud)
我现在在内容视图的正文中有以下文本对象:
var body: some View {
VStack(alignment: .leading) {
Text("Welcome")
.font(.largeTitle)
.color(Color.black)
Text("to SwiftUI")
.font(.largeTitle)
.color(Color.secondary)
}
}
Run Code Online (Sandbox Code Playgroud)
所以现在,我想用Texts 替换这两个Title:
var body: some View {
VStack(alignment: .leading) {
Title("Welcome")
Title("to SwiftUI")
}
}
Run Code Online (Sandbox Code Playgroud)
替换视图后,我从Xcode收到一些看似无关的错误消息,这些错误消息使应用程序无法编译:
静态成员“ leading”不能用于“ HorizontalAlignment”类型的实例
'(LocalizedStringKey)-> Text'不能转换为'(LocalizedStringKey,String ?, Bundle ?, StaticString?)-> Text'
“字体”不能转换为“字体?”
...和更多。恢复Text而不是Title“修复”问题。
有趣的是,我还有一个自定义PrimaryButton视图,可以添加它而没有任何问题: …
在遵循Apple 关于用户输入的教程之后,我实现了一个切换。当前,它看起来像这样:

这是产生此UI的代码:
NavigationView {
List {
Toggle(isOn: $showFavoritesOnly) {
Text("Show Favorites only")
}
}
}
Run Code Online (Sandbox Code Playgroud)
Now, I'd like the Toggle's on-color to be blue instead of green.
I tried:
Toggle(isOn: $showFavoritesOnly) {
Text("Show Favorites only")
}
.accentColor(.blue)
Run Code Online (Sandbox Code Playgroud)
.foregroundColor(.blue)
Run Code Online (Sandbox Code Playgroud)
.background(Color.blue)
Run Code Online (Sandbox Code Playgroud)
None of these worked and I wasn't able to find any other modifiers, such as tintColor.
How do I change the color of a Toggle?
我一直在关注Apple的SwiftUI教程。在此过程中,我经常将Text对象与以下初始化程序一起使用:
/// Creates an instance that displays `content` verbatim.
public init<S>(_ content: S) where S : StringProtocol
Run Code Online (Sandbox Code Playgroud)
Now, in the fifth tutorial of the series, I've encountered the following usage of Text:
Text(verbatim: "")
Run Code Online (Sandbox Code Playgroud)
The description in the interface is the same as for the other initializer:
Text(verbatim: "")
Run Code Online (Sandbox Code Playgroud)
What's the two initializers for and how are they different / when would I use which?
我想添加书法笔刷效果,如下图所示。我正在使用SwiftyDrawView进行绘图。
以下是SwiftyDraw的代码片段
/// Overriding draw(rect:) to stroke paths
override open func draw(_ rect: CGRect) {
super.draw(rect)
guard let context: CGContext = UIGraphicsGetCurrentContext() else { return }
for line in lines {
context.setLineCap(.round)
context.setLineJoin(.round)
context.setLineWidth(line.brush.width)
// set blend mode so an eraser actually erases stuff
context.setBlendMode(line.brush.blendMode)
context.setAlpha(line.brush.opacity)
context.setStrokeColor(line.brush.color.cgColor)
context.addPath(line.path)
context.strokePath()
}
}
Run Code Online (Sandbox Code Playgroud)
// TouchBegan
override open func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
guard isEnabled, let touch = touches.first else { return }
if #available(iOS 9.1, …Run Code Online (Sandbox Code Playgroud) 我想永远动画2个立方体,直到用户点击其中一个.动画应该像∞一样.
这些是我想要动画的sceneView中的我的立方体:

我试图用嵌套动画做到这一点,它确实部分工作.现在,由于动画总是等到它们在开始新动画之前完成,它看起来并不光滑.
在继续开发∞动画之前,我想知道是否有更好的(实际工作)方式.这是我目前的代码:
SCNTransaction.begin()
SCNTransaction.setAnimationDuration(2)
cube1.position = SCNVector3Make(3, 0, 0)
cube2.position = SCNVector3Make(-3, 0, 0)
println("log 0")
SCNTransaction.setCompletionBlock {
println("log 1")
while (animationKey != 1) {
//initially animationKey = 0
SCNTransaction.begin()
SCNTransaction.setAnimationDuration(2)
cube1.position.x += 1
cube1.position.y += 1
cube2.position.x += 1
cube2.position.y += 1
println("log 2")
SCNTransaction.setCompletionBlock {
SCNTransaction.begin()
SCNTransaction.setAnimationDuration(2)
cube1.position.x -= 1
cube1.position.y -= 1
cube2.position.x -= 1
cube2.position.y -= 1
println("log 3")
SCNTransaction.setCompletionBlock { animationKey = 1 }
SCNTransaction.commit()
}
println("log 4")
SCNTransaction.commit()
}
}
println("log 5") …Run Code Online (Sandbox Code Playgroud) 收到此错误:
/Users/brendanwinter/Library/Developer/Xcode/DerivedData/Sidearm-bpmbvflilopwujbzzhkazqidiguc/Build/Intermediates/Sidearm.build/Debug-iphonesimulator/louisville.build/Script-52247AC61D89704E005DF2FA.sh: line 2: /R.swift/rswift: No such file or directory

我努力了:
在处理场景套件应用程序时,我有 2 个盒子可以相互射击以获得点数。这是第一个框需要射击的位置的计算:
shot1 = SCNNode()
shot1.geometry = SCNSphere(radius: 0.5)
shot1.physicsBody = SCNPhysicsBody.dynamic()
shot1.position = SCNVector3Make
(boxNode1.position.x,
boxNode1.position.y + 1,
boxNode1.position.z - 1)
scnScene.rootNode.addChildNode(shot1)
Run Code Online (Sandbox Code Playgroud)
对于第二个框:
shot2 = SCNNode()
shot2.geometry = SCNSphere(radius: 0.5)
shot2.physicsBody = SCNPhysicsBody.dynamic()
shot2.position = SCNVector3Make
(boxNode2.position.x,
boxNode2.position.y + 1,
boxNode2.position.z + 1)
scnScene.rootNode.addChileNode(shot2)
Run Code Online (Sandbox Code Playgroud)
每一次射击都在正确的位置进行,然后被扔到另一个盒子上,并在其物理体上施加力作为脉冲。
对于触摸实现,我使用 touchesBegan 来搜索触摸,然后如果触摸具有 hitResult,我将按上述方式开火。
问题发生在:如果例如 shot1 击中 boxNode2,boxNode2 会按我的预期向后移动,这次如果我用 boxNode2 射击,shot2 的起始位置不在我预期的 boxNode2 的新位置,并且开始在开始的地方开火!
那么我怎样才能从 boxNodes 的新位置开火呢?
我ARKit使用测试版的Xcode 9 创建了一个项目,我可以在我的真实设备上运行而没有任何问题.
昨天,我升级到Xcode 9 GM,没有触及任何东西,Xcode显示多个错误,说它不知道ARSessionConfiguration即:
使用未声明类型'ARSessionConfiguration'
和:
使用未声明类型'ARWorldTrackingSessionConfiguration'
...对于此代码:
let session = ARSession()
var sessionConfig: ARSessionConfiguration = ARWorldTrackingSessionConfiguration()
Run Code Online (Sandbox Code Playgroud)
我已经导入ARKit并使用了ARSCNViewDelegate我的ViewController.
从Xcode的测试版打开项目时,它不会显示错误,我可以再次在手机上运行该应用程序.
知道如何解决这个问题吗?
swift ×7
ios ×5
swiftui ×3
scenekit ×2
animation ×1
arkit ×1
autofill ×1
ios11 ×1
ios12 ×1
objective-c ×1
swift3 ×1
swifty-draw ×1
toggle ×1
uitableview ×1
xcode9 ×1