I can't seem to get the MonoTouch.Dialog to rotate. In my constructor, I set Autorotate = true. I also added all orientations in the supported orientations section of info.plist. I also overrode the ShouldAutorotateToInterfaceOrientation method to return true. Am I missing something?
When using a default template from MonoDevelop then only setting Autorotate to true on every DialogViewController (not just the main one) should be enough.
E.g. this is what Touch.Unit does and rotation works without any issue. You might want to check and compare its code with your own code.
Related
Given:
#property({type: Boolean, attribute: 'some-attr'}) someAttr = false;
I was expecting to see updated being fired once 'some-attr' value gets updated in the DOM.
However, updated doesn't get fired at all.
Is my expectation wrong, or should I set things up differently?
Looking at Elm's discussion of properties vs attributes, the documentation of the Html.Attributes module's attribute function, and the Elm documentation on custom elements, I am pretty sure, that this is caused by simply binding an elm expression to attribute some-attr of the LitElement based custom element. I.e. the DOM attribute will always be present and hence the corresponding property always be true.
The default converter for Boolean (activated by providing type:Boolean to the decorator) mimicks the behaviour of HTML attributes used as flags (e.g. disabled on an <input> element): If the attribute is present (no matter the value), the flag is set (true). The implementation is really straight forward, if you want to look at it in the sources: https://github.com/Polymer/lit-element/blob/master/src/lib/updating-element.ts#L163
I see these options for your problem:
Implement some extra logic in Elm to add / remove the presence of the attribute.
Create your own attribute converter for the LitElement based custom element.
Use another default converter (e.g. for String, the "default" default converter) and implement the custom logic inside the LitElement (e.g. using a derived value).
Of these 3 options, I would generally recommend the first one, as your custom element then still behaves naturally, i.e. if some-attr should be a flag (boolean attribute), then following which HTML semantics, it should be defined by its presence, not its value. This allows you to re-use it in other projects without surprising other developers.
That being said, there may of course be project-specific requirements, that are more important. E.g. if you only use this custom element in this one project with Elm, your road to success may be faster going for options 2 or 3.
I am developing an app with a custom subclassed WKWebView, and I am trying to disable the default options when a user selects some text inside the webview, and implement my own options. However, it seems there are 4 options that cannot be removed and will always show: Select To Here, Look Up, Learn..., and Share...
A previous answer claims it's possible by overriding canPerformAction() or swizzling canPerformAction on WKContentView, but I've tried both and it hasn't worked. Specifically, there is no UIResponder selectors available for the 4 options, even though they show up when I print a list of all actions coming into canPerformAction.
Another answer have claimed it might be possible to disable default options if canPerformAction() returns false from the First Responder, except WKWebView refuses to become the First Responder by calling becomeFirstResponder while selecting text, and forcibly doing so by calling resign on the WKContentView seems to disable interactions with the WebView altogether. Also tried swizzling canPerformAction on the child WKContentView, but it seems not to make any difference.
I can only assume the default options are being handled further down the chain, but when I break the chain by setting the next UIResponder to nil, canPerformAction no longer gets called and no menu shows up anymore.
I'm at a loss here, how can I simply show a customised menu upon text selection?
Testing on
XCode 11.6
iOS 13.6
I've read the documentation of this attribute:
An additional flag to be used with 'snap'. If set, the view will be snapped to its top and bottom margins, as opposed to the edges of the view itself.
https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout.LayoutParams.html#scroll_flag_snap
But I can't observe any actual effect in my app. What margin are they talking about? Every margin on the CollapsingToolbarLayout (on which this attribute is set) completely destroys the layout.
Not sure if it's useful yet, but here is the difference:)
If you pass snap as scroll flag, then it will move your view (in my case this search bar, it's linearLayout) to it's edge NOT INCLUDING the margin_layout
Then I've tried snap|snapMargin and it moved with the margin
P.S. No idea why snapMargin doesn't work without snap ¯\_(ツ)_/¯
This attribute is responsible for a scrolling behavior of AppBarLayout and its children. You can apply it directly to AppBarLayout or on the inside views, in the xml layout of your AppCompatActivity. It has to be an instance of AppCompatActivity if you want to use AppBar features. Also, the design library must be included in Gradle dependencies, like so: implementation 'com.android.support:design:26.1.0'
Please refer this link:-[https://medium.com/#tonia.tkachuk/appbarlayout-scroll-behavior-with-layout-scrollflags-2eec41b4366b][1]
I want to detect the scroll of tableview in my class. I used decelerationEnded method of UITableViewDelegate but it got crashed.
Ideally you should be using a UITableViewSource assigned to your UITableView.Source property. You no longer require a delegate class, you can override all of the necessary methods within the source, which is the currently preferred method of achieving the result your after. You are most likely looking to override the method called 'Scrolled' within the UITableViewSource. However I would suggest making use of 'DecelerationEnded' as well if you're trying to do something depending on if your scroll view is at the 'bottom' or 'top' of the UITableViews content (That's just a little tip based off of some experience with this in a recent project.)
Is this possible to apply new style to already created DialogViewController? In one of my views I need to clear root and change from grouped to plain view.
Just setting style to new one doesn't do anything, so I'm not sure if I need to call some refresh method or this is not possible at all.
Found out looking at Monotouch.Dialog code that you need to call TableView.LoadView for this to happen.