Posts

Post not yet marked as solved
0 Replies
368 Views
Hello, I've built a shortcut that crops images into a square format of (width x width). The shortcut works well for photographs, but not so for screenshots. While the result is a square image, the size is smaller by a factor of 3.123 on each side. Also the resulting image seems to be squashed vertically
Posted
by plutovman.
Last updated
.
Post not yet marked as solved
0 Replies
394 Views
Hello. I've made a shortcut to convert an image from native format to png. The shortcut works as advertised for photos, but not for screenshots. For instance, a screenshot of resolution (1125x2436), when converted to png/jpg becomes 360x780)
Posted
by plutovman.
Last updated
.
Post not yet marked as solved
0 Replies
1.5k Views
I have a UITableView with cells that have swappable UIContextualActions to delete or rename (edit) individual cell's TextFields. Since I made the switch to Swift 5 / iOS 13, triggering the rename UIContextualAction on these cells causes the keyboard to launch and instantly dismiss before the user has a chance to type. Not only does the keyboard go away, the particular cell I'm trying to edit becomes completely empty, and the following warning gets generated: [Snapshotting] Snapshotting a view (0x10c90a470, _UIReplicantView) that has not been rendered at least once requires afterScreenUpdates:YES.Below is the code for the rename UIContextualAction: let actionRename = UIContextualAction(style: .normal, title: "") { (action, view, completionHandler) in let cell = self.tableLayers.cellForRow(at: indexPath) as! LayerUITableViewCell cell.layerTitle.isEnabled = true // enable UITextField editing cell.layerTitle.becomeFirstResponder() // launch keyboard cell.layerTitle.selectedTextRange = cell.layerTitle.textRange(from: (cell.layerTitle.beginningOfDocument), to: (cell.layerTitle.endOfDocument)) // select all text completionHandler(true)} // end of let actionRenameI'm guessing the animation of the UIContextual action is somehow triggering the keyboard's resignFirstResponder. To summarize, prior to swift 5/iOS 13, the order of events went something like this: user swipes cell left/rightuser hits UIContextual buttoncell returns to centertext gets selectedkeyboard launchesuser types, hits returnkeyboard resignFirstResponderWhereas the behavior I'm seeing after the migration looks like this:user swipes cell left/rightuser hits UIContextual buttontext gets selectedkeyboard launchescell returns to center (which somehow triggers resignFirstResponder)keyboard resignFirstResponderUpdate 2019/10/02I have confirmed that it's the cell animation that is causing the premature keyboard dismissal. If I introduce a delay after the completionHandler as follows:let actionRename = UIContextualAction(style: .normal, title: "") { (action, view, completionHandler) in completionHandler(true) self.perform(#selector(self.layerRenameDos), with: nil, afterDelay: 1.0) // layerRenameDos has the editing/firstResponder code from above } // end of let actionRenameWith this change, the cell animates back to center, keyboard launches, and I'm able to type away. This, however, is obviously a hacky work-around. Any suggestions would be appreciated
Posted
by plutovman.
Last updated
.
Post not yet marked as solved
0 Replies
439 Views
I am working on a drawing app, and I've noticed during my Apple Pencil testing, that touchesEndedgets prematurely called when the current pencil-triggered touch event gets interrupted by a second touch. This does not happen when, say, I am drawing using a finger, and I introduce a second simultaneous touch. I also notice that the touchCount does not increase when I have a pencil touch and a finger touch simultaneously. Similarly (perhaps by design) gestures don't work with mixed touch types. Below I show how I'm accounting for active touches during touchesMovedoverride func viewDidLoad() { ... self.view.isMultipleTouchEnabled = true ... } func touchesMoved(touches: Set<UITouch>, event: UIEvent?) { if let touch = touches.first { let event = event let touchCount = touches.count print ("[ComponentPagePaint]: TOUCH COUNT = \(touchCount)") let numFingersOnScreen: Int = ((event?.allTouches!.count)!) print ("[ComponentPagePaint]: FINGr COUNT = \(numFingersOnScreen)") } }It appears that mixing touch types results in the UIView ending the first touch and switching to the second. This does not happen when I have multiple simultaneous TouchType.direct touches. Note that this behavior also seems to be present in Apple's drawing demo project.Is there any way to change this behavior? Ideally, I'd like my pencil-triggered touch cycle to NOT be interrupted by a second touch.If the latter is not possible, is there a way for me to properly account for ALL active touches so that I can cancel the current stroke, or do something else?
Posted
by plutovman.
Last updated
.