Today I met a wonderful bug when I wrote some controls add to a UIView.
After running, clicking on the controls on the interface is no problem, but when I click on the UIView blank area, the entire uiview is transparent, including the child controls.
I guess it should be the default check effect.
First: The control does not need to click events for UIView
Add an empty Click event to the UIView with the following code:
Uiview.addgesturerecognizer (New Uigesturerecognizer ());
After the operation found that the click of the blank will not be transparent, but the child control in which the click of the event is also blocked off.
the second: a complete picture can be displayed for an initial interface
The reason for this problem is to inherit the base class of Mvxdialogviewcontroller. So one way is to inherit the base class and replace it with Mvxviewcontroller. Alternatively, some of our own view additions are shown in root, so we add these view as the TableView cell in the Mvxdialogviewcontroller. The default selected style of the frame is clicked to become transparent, so the bug appears.
Workaround: After adding root, iterate through each cell, setting their selected style, as follows:
public override void Viewdidload ()
{
base. Viewdidload ();
Tableview.separatorstyle = Uitableviewcellseparatorstyle.none;
Root = (rootelement) getroot ();
Recycle remove selected effect
var cell = root.tableview.visiblecells[0];
Cell. Selectionstyle = Uitableviewcellselectionstyle.none;
var cell1 = root.tableview.visiblecells[1];
Cell1. Selectionstyle = Uitableviewcellselectionstyle.none;
var cell2 = root.tableview.visiblecells[2];
Cell2. Selectionstyle = Uitableviewcellselectionstyle.none;
}
In this way, it can be understood from the literal meaning of the method that the click effect of the view that is being displayed in the interface is removed. When our interface is long enough for the initial interface to show up, then some of the following uiview clicks will be transparent.
Third: For the interface is long enough, but also a good way to solve the drunk
In fact, this blog at the beginning only the above two solutions, after I developed a period of time, testing their own interface, using the interface of the second way above, pull to the bottom or there will be a click on the issue of transparency. So after trying again, write this solution.
As mentioned above, after inheriting the Mvxdialogviewcontroller, the view we added to root appears as a cell, that is, we can think of Mvxdialogviewcontroller as a UI tableview (actually he is.) Since it inherits it to set the Uitableviewstyle later). Then there is a select method in UITableView that you can set the selected row, Mvxdialogviewcontroller certainly. So I tried to find out, really. The following select method is then used to recall the parameters clicked:
public override void Selected (Foundation.nsindexpath indexpath)
{
base. Selected (Indexpath);
Remove the selected effect
Root.TableView.CellAt (Indexpath) according to the clicked Indexpath. Selectionstyle = Uitableviewcellselectionstyle.none;
}
Get..