在iOS 13 Beta 1中,出现模态视图控制器时有新行为。现在默认情况下它不是全屏显示,当我尝试向下滑动时,该应用程序会自动关闭View Controller。
如何防止这种行为并回到旧的好全屏模式vc?
谢谢
在 UIKit iOS 13 更改之前,如何在 SceneDelegate 设置 rootViewController?
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
@available(iOS 13.0, *)
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let _ = (scene as? UIWindowScene) else { return }
}
Run Code Online (Sandbox Code Playgroud) UITextField 有一个.placeholdertext 属性,用于在文本添加到字段之前显示信息,到目前为止它一直清晰可见,但在 iOS13 暗模式中引入,现在占位符文本在白色 UITextField 中几乎不可读(我明确表示通过.backgroundColor = [UIColor whiteColor])使其变白。
我的问题是,在我的整个项目中有哪些实用的解决方案可以解决这个问题,我可以手动更改任何 UITextField 上的占位符颜色,只需设置一个attributedPlaceholder字符串,这可能需要一段时间,有没有办法禁用暗模式设置专门针对 UITextFields 而不是针对其他元素?
我是 SceneDelegate 设置的新手。我注意到在 info.plist 中,我们有一个映射Scene Configuration:
Configuration Name: Default Configuration <- this key
Delegate Class Name: $(PRODUCT_MODULE_NAME).SceneDelegate <- this file
Run Code Online (Sandbox Code Playgroud)
然后在 AppDelegate 中connectingSceneSession,我们使用 key 返回配置Default Configuration。
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
Run Code Online (Sandbox Code Playgroud)
是否可以避免这种(key -> file)映射info.plist,并以编程方式连接它?
注意:我不是在问故事板。有大量关于删除故事板的教程,我知道这一点。
我正在尝试构建一个基本应用程序,以使用 Multipeer Connectivity Framework 在附近的 iOS 设备之间发送消息。我已经尝试了很多教程,但似乎在 Xcode 11 中浏览附近的设备并接受请求不像以前那样工作。
这是我的视图控制器和委托方法:
import UIKit
import MultipeerConnectivity
class ViewController: UIViewController,MCSessionDelegate,MCBrowserViewControllerDelegate {
var peerID: MCPeerID?
var session: MCSession?
override func viewDidLoad() {
super.viewDidLoad()
peerID = MCPeerID(displayName: UIDevice.current.name)
session = MCSession(peer: peerID!, securityIdentity: nil, encryptionPreference: .none)
session!.delegate = self
}
func session(_ session: MCSession, peer peerID: MCPeerID, didChange state: MCSessionState) {
switch state {
case .connected: print("Connected to \(peerID.displayName)")
case .connecting: print("Connecting: \(peerID.displayName)")
case .notConnected: print("Not Connected: \(peerID.displayName)")
default: print("")
}
}
func session(_ …Run Code Online (Sandbox Code Playgroud) 根据我的应用程序项目设置,\n我使用相同的代码进行以下函数调用,以分别在 SceneDelegate 和 AppDelegate 中实例化 rootVC
\nfunc scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {\n\n}\n\xe2\x80\xa8func application(_ application: UIApplication,\n didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?)\n -> Bool {\n}\xe2\x80\xa8\nRun Code Online (Sandbox Code Playgroud)\n\xe2\x80\xa8\xe2\x80\xa8为了实现通用链接,我在我的 App Delegate\xe2\x80\xa8\xe2\x80\xa8 中有以下回调函数
\nfunc application(_ application: UIApplication,\n continue userActivity: NSUserActivity,\n restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {\n//code to capture and setup universal link\n}\nRun Code Online (Sandbox Code Playgroud)\n\xe2\x80\xa8AppDelegate 中的这个函数仅在低于 iOS 13 的设备中调用。我寻找了 SceneDelegate 的类似回调等效项,我能找到的最接近的是这个函数。\xe2\x80\xa8\xe2\x80\xa8
\nfunc scene(_ scene: UIScene, continue userActivity: NSUserActivity) {\n//code to capture and setup universal link\n}\nRun Code Online (Sandbox Code Playgroud)\n … 当MCBrowserViewController调用
-[MCBrowserViewController advertiser:didNotStartAdvertisingPeer:]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)
错误信息被抛出。
当MCAdvertiserAssistant尝试开始广告时
-[MCAdvertiserAssistant advertiser:didNotStartAdvertisingPeer:]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)
错误信息被抛出。
被击中而无法继续。我的业务取决于MultipeerConnectivity框架。
任何帮助将不胜感激。
ios ×6
swift ×5
ios13 ×3
uikit ×2
deep-linking ×1
ios-darkmode ×1
ios14 ×1
objective-c ×1
swift3 ×1
uitextfield ×1