Merge branch 'master' of https://github.com/Clancey/HotForms into mac
This commit is contained in:
Коммит
d51cc7700d
|
@ -6,6 +6,10 @@ namespace HotUI.iOS {
|
|||
public ButtonHandler ()
|
||||
{
|
||||
this.TouchUpInside += ButtonHandler_TouchUpInside;
|
||||
this.SetTitleColor (UIColor.Blue, UIControlState.Normal);
|
||||
this.Layer.BorderColor = UIColor.Blue.CGColor;
|
||||
this.Layer.BorderWidth = .5f;
|
||||
this.Layer.CornerRadius = 3f;
|
||||
}
|
||||
|
||||
private void ButtonHandler_TouchUpInside (object sender, EventArgs e) => button?.OnClick ();
|
||||
|
|
|
@ -4,14 +4,22 @@ namespace HotUI.iOS {
|
|||
public class EntryHandler : UITextField, IUIView {
|
||||
public EntryHandler ()
|
||||
{
|
||||
this.Ended += EntryHandler_Ended;
|
||||
this.EditingDidEnd += EntryHandler_EditingDidEnd;
|
||||
|
||||
this.ShouldReturn = (s) => {
|
||||
this.ResignFirstResponder ();
|
||||
return true;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
private void EntryHandler_EditingDidEnd (object sender, EventArgs e) =>entry?.Completed (Text);
|
||||
|
||||
public UIView View => this;
|
||||
|
||||
public void Remove (View view)
|
||||
{
|
||||
|
||||
entry = null;
|
||||
}
|
||||
Entry entry;
|
||||
public void SetView (View view)
|
||||
|
@ -26,7 +34,6 @@ namespace HotUI.iOS {
|
|||
this.UpdateProperty (property, value);
|
||||
}
|
||||
|
||||
void EntryHandler_Ended (object sender, EventArgs e) => entry?.Completed (this.Text);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace HotUI.iOS {
|
|||
public override void LoadView ()
|
||||
{
|
||||
base.LoadView ();
|
||||
View.BackgroundColor = UIColor.Gray;
|
||||
View.BackgroundColor = UIColor.White;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,18 +40,33 @@ namespace HotUI.iOS {
|
|||
List<UIView> views = new List<UIView> ();
|
||||
protected void UpdateChildren (Stack stack)
|
||||
{
|
||||
views.ForEach (x => {
|
||||
RemoveArrangedSubview (x);
|
||||
x.RemoveFromSuperview ();
|
||||
});
|
||||
var children = stack.GetChildren ();
|
||||
if (views.Count == children.Count) {
|
||||
bool areSame = false;
|
||||
for (var i = 0; i < views.Count; i++) {
|
||||
var v = views [i];
|
||||
var c = children [i].ToView ();
|
||||
areSame = c == v;
|
||||
if (!areSame) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (areSame)
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var v in views) {
|
||||
RemoveArrangedSubview (v);
|
||||
v.RemoveFromSuperview ();
|
||||
}
|
||||
views.Clear ();
|
||||
foreach (var child in stack.GetChildren ()) {
|
||||
foreach (var child in children) {
|
||||
var cview = child.ToView ();
|
||||
views.Add (cview);
|
||||
//cview.ContentMode = UIViewContentMode.Top;
|
||||
AddSubview (cview);
|
||||
AddArrangedSubview (cview);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -148,7 +148,9 @@ namespace HotUI {
|
|||
|
||||
if (pendingUpdates.Any ()) {
|
||||
if (UpdateParentValueChanged != null) {
|
||||
UpdateParentValueChanged (this, pendingUpdates);
|
||||
var updates = pendingUpdates.ToList ();
|
||||
pendingUpdates.Clear ();
|
||||
UpdateParentValueChanged (this, updates);
|
||||
} else if (!BindingState.UpdateValues (pendingUpdates)) {
|
||||
pendingUpdates.Clear ();
|
||||
StateChanged?.Invoke ();
|
||||
|
@ -161,7 +163,8 @@ namespace HotUI {
|
|||
|
||||
protected T GetProperty<T> ([CallerMemberName] string propertyName = "")
|
||||
{
|
||||
if (isBuilding) {
|
||||
//Ignore View for the ViewBuilders
|
||||
if (isBuilding && typeof(T) != typeof(View)) {
|
||||
listProperties.Add (propertyName);
|
||||
}
|
||||
|
||||
|
@ -192,13 +195,16 @@ namespace HotUI {
|
|||
TrackChild (propertyName, b);
|
||||
}
|
||||
dictionary [propertyName] = value;
|
||||
changeDictionary [propertyName] = value;
|
||||
//If this is tied to a parent, we need to send that notification as well
|
||||
if (!string.IsNullOrWhiteSpace (ParentProperty))
|
||||
pendingUpdates.Add (($"{ParentProperty}.{propertyName}", value));
|
||||
pendingUpdates.Add ((propertyName, value));
|
||||
if (!isUpdating) {
|
||||
EndUpdate ();
|
||||
//If we track the ViewBuilder.View property it can easily get into a loop!
|
||||
if (typeof (T) != typeof (View)) {
|
||||
changeDictionary [propertyName] = value;
|
||||
//If this is tied to a parent, we need to send that notification as well
|
||||
if (!string.IsNullOrWhiteSpace (ParentProperty))
|
||||
pendingUpdates.Add (($"{ParentProperty}.{propertyName}", value));
|
||||
pendingUpdates.Add ((propertyName, value));
|
||||
if (!isUpdating) {
|
||||
EndUpdate ();
|
||||
}
|
||||
}
|
||||
PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (propertyName));
|
||||
return true;
|
||||
|
|
|
@ -36,7 +36,10 @@ namespace HotUI {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (EqualityComparer<T>.Default.Equals (currentValue, newValue))
|
||||
return;
|
||||
currentValue = newValue;
|
||||
|
||||
onUpdate (propertyName, newValue);
|
||||
}
|
||||
static T Cast<T>(this object val)
|
||||
|
|
Загрузка…
Ссылка в новой задаче