Using UIDatePicker inline style in popover - avoiding keyboard - uikit

I am using the new UIDatePicker 'inline' style in iOS14, and I want to show the picker inside a popover, like I did before in iOS13. I manage to do this fine, but the problem happens when you select the 'time' picker which brings up the keyboard, causing the date picker to get squished.
I'm not sure how I can avoid this happening. I've tried:
scrolling the presenting view controller's tableview to the top, and added a contentInset
setting a height constraint for the UIDatePicker control
listening to keyboard notifications, which get triggered but not sure what to do with it
Is there anything else I can try to get it to work correctly? Would love some ideas on potential solutions.

Related

Using infinite scrolling UICollectionView with iOS 13 pullable modals

I have a modal window, which is perfect for iOS 13's drag to dismiss gesture, because this way the user remains in the context, so I don't want to use full screen. The controller contains a UICollectionView which displays a month calendar, which is scrollable vertically.
The problem is, that when the user wants to scroll upwards in the collection view, the dismiss gesture is triggered instead. If I scroll down first, then can I only scroll up.
I've tried to disable the internal UIPanGestureRecognizer (it seems somehow there is no presentedView, so it didn't work), tried to set the UICollectionView's pan gesture recognizer delegate to prevent the system recognizer to fire (it turned out you can't do that), and tried to scroll the collection view on appearing a bit (ugly).
How can I elegantly convince the the modal presentation, that my scrollview isn't scrolled to the top?

Expand tooltip on hover in NSCollectionView not working after ReloadData or tab change

I have an NSCollectionView inside a Tab which contains subviews with NSTextField that have expanding tooltips.
Strangely, after a new search (ReloadData) or going to a tab and coming back, the tooltips no longer expand. They come back only if I resize the window or scroll the CollectionView*. Clicking in the view does not help. What can I do to automatically have the tooltips work?
*This triggers the CollectionView and the CollectionViewItems to UpdateTrackingAreas. I tried to force this on ReloadData even delayed 1000 ms, but this did not make the tooltips able to expand.
Thoughts:
Something related to UpdateTrackingAreas but not exactly?
Maybe a first responder issue?
It also doesn't work if the window is not the active window (which is ok)
Concerned that it might be related to How do I update the expansion tooltip size after calling NSTextField setStringValue:?

Charm 4.0.1 possibility to disable layout adjustment when keyboard shows up

I'm facing several problems with the new function which is responsible for adjusting the view layout, when the keyboard shows up.
For example when a DatePicker is shown while a TextField is focused:
Is there a possibility to disable this function?
EDIT:
While removing the focus from the TextField before the DatePicker is shown works, there are still some others issues so I would prefer to use my own custom solution AndroidNodePositionAdjuster.
Another issue e.g. is an unpleasant white area (which will be covered by the keyboard), when the view is transitioned upwards to make room for the soft keyboard, so the transition appears very unsmooth:

NSTextField dragging values

I am trying to create a text field in the Mac OSX environment that allows a user to select a number and drag horizontally to adjust that number up and down.
I know this can be done because Apple have implemented it in the inspector panel of the Sprite Kit emitter section: see the image
I have tried sub classing NSTextField to capture mouse drag events and doing the math, but they don't seem to get passed through. The mouse down event does though...
I have also tried placing a dummy view over the top and catching events as they come through. This works for mouse down, but again, the mouse dragged is never called. I know that the view can receive the mouse dragged event though, because if I place that view somewhere that a text field isn't under it, everything works fine.
What are my options here? I feel I have tried everything and the only option left is to create a new control from scratch. I don't mind that too much, but I also want the user to be able to add equations in the text field and drag individual values - that means the full functionality of NSTextField will need to be rebuilt just to add this dragging feature... Is there anything else???

Popup UIPicker when tapping on UITextField

I need to display/show a Picker when a user taps on a textfield, I mean, it should appear a picker instead of a keyboard. Also, some sort of "done" button above the picker so the user clicks on it and the value from the picker is copied to the textfield and the picker is hidden again.
I've checked many tutorials from the web but haven't found anyone that can really help me.
I found a tutorial that pointed me in the right direction but I'm still missing to disappear the keyboard when clicking on the textfield.
Dismissing UIPickerView with Done button on UIToolBar by #slev
Any ideas?
If you're not targeting iOS versions older than 3.2, it's easy. You can either assign the UIPickerView as the inputView property of the UITextField and the UIToolbar containing the 'done' button as the inputAccessoryView, or you could make a single UIView that has both the picker and the toolbar as subviews and assign that as the intputView (and leave inputAccessoryView as nil). Either way, this will animate your picker in in place of the normal keyboard when the text field is activated.
More details on this are available in the documentation.

Resources