uikit

UITextField backgroundColor set in Interface Builder is nil at runtime in iOS 14

大城市里の小女人 提交于 2020-12-30 06:12:34
问题 I have an app that works properly on iOS 11-13, but when I run it in iOS 14 several text fields within it are rendered with a nil, and so transparent, background color even though the background color is set to White explicitly in the Interface Builder. I can't see anywhere in the code that uses those text fields that might mess up the background color, and these same UITextFields running under the same scenarios appear with White background on iOS 13 and below. If I set the color explicitly

Delete (not Backspace) doesn't fire UITextViewDelegate's shouldChangeTextInRange

与世无争的帅哥 提交于 2020-12-29 10:11:15
问题 When using an external keyboard, my UITextView fires a shouldChangeTextInRange message just fine when I press the Backspace key ("backward delete"), but if I press Delete ("forward delete") then the method is never called at all, despite the view's text changing as expected. In case it matters, I'm using Swift and the latest iOS simulator. If this is expected behavior, can someone point me to the documentation that explains it? More importantly, is there a workaround? Edit: submitted rdar:/

Delete (not Backspace) doesn't fire UITextViewDelegate's shouldChangeTextInRange

…衆ロ難τιáo~ 提交于 2020-12-29 10:09:44
问题 When using an external keyboard, my UITextView fires a shouldChangeTextInRange message just fine when I press the Backspace key ("backward delete"), but if I press Delete ("forward delete") then the method is never called at all, despite the view's text changing as expected. In case it matters, I'm using Swift and the latest iOS simulator. If this is expected behavior, can someone point me to the documentation that explains it? More importantly, is there a workaround? Edit: submitted rdar:/

Delete (not Backspace) doesn't fire UITextViewDelegate's shouldChangeTextInRange

只愿长相守 提交于 2020-12-29 10:09:28
问题 When using an external keyboard, my UITextView fires a shouldChangeTextInRange message just fine when I press the Backspace key ("backward delete"), but if I press Delete ("forward delete") then the method is never called at all, despite the view's text changing as expected. In case it matters, I'm using Swift and the latest iOS simulator. If this is expected behavior, can someone point me to the documentation that explains it? More importantly, is there a workaround? Edit: submitted rdar:/

Delete (not Backspace) doesn't fire UITextViewDelegate's shouldChangeTextInRange

雨燕双飞 提交于 2020-12-29 10:06:04
问题 When using an external keyboard, my UITextView fires a shouldChangeTextInRange message just fine when I press the Backspace key ("backward delete"), but if I press Delete ("forward delete") then the method is never called at all, despite the view's text changing as expected. In case it matters, I'm using Swift and the latest iOS simulator. If this is expected behavior, can someone point me to the documentation that explains it? More importantly, is there a workaround? Edit: submitted rdar:/

Core data + CloudKit - sharing between iOS and watchOS companion app

末鹿安然 提交于 2020-12-29 06:54:27
问题 In my app I store data with core data. Recently I discovered the new feature introduced by Apple in WWDC19 which allows core data to work with CloudKit. I just enabled cloudKit for my app and used an NSPersistentCloudKitContainer instead of NSPersistentContainer and all was set up ! All my data is shared between ios devices. That works like NSPersistentContainer but it sends a copy of changes on icloud server, so there is always a local cache of data. Now I'd like to access that data from my

Get light or dark variant of a color declared in assets

↘锁芯ラ 提交于 2020-12-27 06:12:42
问题 In my assets I have declared a theme color in two variants for both light and dark appearances, which works great. However, I have a specific place in the app where I need to use the light variant of the color regardless of whether dark mode is enabled or not. Is there any other way of getting that color in code, other than declaring the same color as a separate one with only a single variant? 回答1: In SwiftUI if there is need to use light variant for some subview it is enough to force specify

Get light or dark variant of a color declared in assets

孤街浪徒 提交于 2020-12-27 06:12:13
问题 In my assets I have declared a theme color in two variants for both light and dark appearances, which works great. However, I have a specific place in the app where I need to use the light variant of the color regardless of whether dark mode is enabled or not. Is there any other way of getting that color in code, other than declaring the same color as a separate one with only a single variant? 回答1: In SwiftUI if there is need to use light variant for some subview it is enough to force specify

默认主控制器

我是研究僧i 提交于 2020-12-10 11:30:32
// // WYBaseViewController.swift // live // // Created by 王武 on 2020/12/7. // import UIKit class WYBaseViewController: UIViewController { // 状态栏背景色 lazy var statusView: UIView = { let view = UIView() view.backgroundColor = kMainOrangeColor view.frame = CGRect(x: 0, y: 0, width: kScreenW, height: kScreenH) // 设置背景渐变 let gradientLayer: CAGradientLayer = CAGradientLayer() gradientLayer.colors = kGradientColors //(这里的起始和终止位置就是按照坐标系,四个角分别是左上(0,0),左下(0,1),右上(1,0),右下(1,1)) //渲染的起始位置 gradientLayer.startPoint = CGPoint.init(x: 0, y: 0) //渲染的终止位置 gradientLayer.endPoint = CGPoint.init(x: 1, y: 0) /

刷新动画

六眼飞鱼酱① 提交于 2020-12-09 15:31:57
// // WYRefreshView.swift // live // // Created by 王武 on 2020/12/9. // import UIKit import ESPullToRefresh class WYRefreshView: WYBaseView { public var insets: UIEdgeInsets = UIEdgeInsets.zero public var view: UIView { return self } public var duration: TimeInterval = 0.5 public var trigger: CGFloat = 56.0 public var executeIncremental: CGFloat = 56.0 public var state: ESRefreshViewState = .pullToRefresh private let imageView: UIImageView = { let imageView = UIImageView.init() imageView.image = UIImage.init(named: "img_mj_statePulling") return imageView }() override func wy_initWithAllView() {