uikit

XCode 8 strange Playground error, Couldn't Lookup Symbols

亡梦爱人 提交于 2020-03-22 07:05:45
问题 I was trying to use auto layout in a Playground on Xcode 8. However, as soon as I added the line, I started receiving this error: Playground execution failed: error: Couldn't lookup symbols: __TWPCSo6UIView17PlaygroundSupport22PlaygroundLiveViewableS0_ __swift_FORCE_LOAD_$_swiftCoreGraphics __swift_FORCE_LOAD_$_swiftDarwin __TMaC17PlaygroundSupport14PlaygroundPage __swift_FORCE_LOAD_$_swiftObjectiveC __swift_FORCE_LOAD_$_swiftUIKit _playground_log_hidden _playground_logger_initialize __swift

SwiftUI : how to access UINavigationController from NavigationView

时光总嘲笑我的痴心妄想 提交于 2020-03-18 05:06:23
问题 I am developing an app using SwiftUI. The app is based around a NavigationView . I am using a third-part framework that provides UIKit components and the framework has not been updated to support SwiftUI yet. One framework method is expecting a parameter of type UINavigationController How can I supply this framework the NavigationControlle r created by SwiftUI ? Or how can I create a UINavigationController that will replace SwiftUI's default ? I read https://developer.apple.com/tutorials

Can't reset UILabel attributedText when a UITableViewCell is reused

你离开我真会死。 提交于 2020-03-17 11:47:47
问题 The problem I'm using a UITableView to show the list of transactions of a credit card. If the transaction is a chargeback, I'm adding a strikethrough style to the label: The problem happens when that specific cell is reused. The strikethrought decoration is still there, even after resetting the text and attributedText property of the label. Below I've added the relevant parts of my code: Table view class TimelineViewController: UIViewController { private lazy var tableView: UITableView = {

Textview moving higher than expected on keyboardWillShowNotification for Iphone X

余生颓废 提交于 2020-03-05 03:56:14
问题 on a function I have titled handleKeyboardWillShow , my input textfield is moving higher than expected. It is my intention for the textfield to be pinned to the top of the keyboard view. I have also added the code to the creation of the text field that seems to be causing the issue. Creation of the textField variable lazy var inputTextField: UITextField = { let tf = UITextField() tf.placeholder = "Enter message..." tf.translatesAutoresizingMaskIntoConstraints = false tf.delegate = self return

Textview moving higher than expected on keyboardWillShowNotification for Iphone X

随声附和 提交于 2020-03-05 03:55:32
问题 on a function I have titled handleKeyboardWillShow , my input textfield is moving higher than expected. It is my intention for the textfield to be pinned to the top of the keyboard view. I have also added the code to the creation of the text field that seems to be causing the issue. Creation of the textField variable lazy var inputTextField: UITextField = { let tf = UITextField() tf.placeholder = "Enter message..." tf.translatesAutoresizingMaskIntoConstraints = false tf.delegate = self return

UITableView with UIViewRepresentable in SwiftUI

不问归期 提交于 2020-03-03 07:44:07
问题 I am trying to use UITableView in a SwiftUI app struct UIList: UIViewRepresentable { var rows: [String] func makeUIView(context: Context) -> UITableView { let collectionView = UITableView(frame: .zero, style: .plain) collectionView.translatesAutoresizingMaskIntoConstraints = false collectionView.dataSource = context.coordinator collectionView.delegate = context.coordinator collectionView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell") return collectionView } func updateUIView(_

UITableView: swiping RowAction cancels the selected rows

泪湿孤枕 提交于 2020-02-25 13:08:48
问题 I can see this behavior in both deprecated UITableViewRowAction class and UISwipeActionsConfiguration class: If you have allowsMultipleSelection property set to true and, let's say, you have 3 rows selected: When you start swiping any row in the table for a RowAction the previously selected rows -- all 3 of them -- become unhighlighted, and the property indexPathsForSelectedRows drops to nil. Does this behavior make sense? Is there any 'deselecting' callback (because I'm displaying the number

ScrollView runs out of memory when it gets too big

旧时模样 提交于 2020-02-25 04:57:46
问题 I've an app which provides to the user some sort of a line graph. I'm using an UIScrollView which is containing the view with graph. The view is using CoreGraphics to draw the graph in it's drawrect method. The problem arises when the graph gets too long. Scrolling through the graph seems to stutter and eventually the app would run out of memory and exit. Looking around at other apps I see the guys who created the WeightBot app were able to manage long ongoing graphs without any problems so

UIColor-subclass crashes when casting from Any?

橙三吉。 提交于 2020-02-24 12:10:08
问题 I know, subclassing UIColor isn't recommended. Apple says Most developers have no need to subclass UIColor But I do. More on why can be found from another question I posted yesterday. That particular issue was solved, but I met another problem. Let's say I have this custom color class: class MyColor:UIColor{ convenience init(test:String){ self.init(red: 0, green: 0, blue: 0, alpha: 1) } } //Then do this anywhere: let myColor = MyColor(test: "test") let temp:Any? = myColor let c = temp as!

Swift UIBezierPath Different Coordinate Starting Point

|▌冷眼眸甩不掉的悲伤 提交于 2020-02-06 07:41:20
问题 I have an UIBezierPath arrow that I found here. My goal is to pass the function "addArrows" a list of player arrays and draw arrows between them. This code works great... except when I call addArrows(gameScene: scene, from: [1, 3], to: [1, 3]) or addArrows(gameScene: scene, from: [2, 3], to: [2, 3]) . This should create arrows between players 1 and 3 (1st call), and 2 and 3 (2nd call). However, it is creating arrows between players 2 and 3 (1st call) and players 1 and 3 (2nd call). I have