summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS
diff options
context:
space:
mode:
authoradrianknight89 <adrianknight89@outlook.com>2017-01-09 10:53:15 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-01-09 10:53:15 (GMT)
commita0417309b8dce62dacce1a5519d6de47533b8802 (patch)
treec4d98ed22f030f73c9c4320f61d51a752e5893b5 /Xamarin.Forms.Platform.iOS
parentc8d54e69ce047b97fdc21afcdad68644ccb1be7a (diff)
downloadxamarin-forms-a0417309b8dce62dacce1a5519d6de47533b8802.zip
xamarin-forms-a0417309b8dce62dacce1a5519d6de47533b8802.tar.gz
xamarin-forms-a0417309b8dce62dacce1a5519d6de47533b8802.tar.bz2
[iOS] Register effects for ScrollView and WebView (#641)
* fix effects * move effect utilities to core * use core class * move to internals namespace * remove IEffectControlProvider from IVisualElementRenderer
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs5
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs4
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs4
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs4
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs9
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs4
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs4
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs9
-rw-r--r--Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs10
9 files changed, 36 insertions, 17 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
index f1364de..d84dd74 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
@@ -382,5 +382,10 @@ namespace Xamarin.Forms.Platform.iOS
Subviews[0].Frame = new RectangleF(0, 0, (float)Element.Width, (float)Element.Height);
}
}
+
+ public void RegisterEffect(Effect effect)
+ {
+ VisualElementRenderer<VisualElement>.RegisterEffect(effect, View);
+ }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
index 55e39ad..6af4021 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
@@ -978,9 +978,7 @@ namespace Xamarin.Forms.Platform.iOS
void IEffectControlProvider.RegisterEffect(Effect effect)
{
- var platformEffect = effect as PlatformEffect;
- if (platformEffect != null)
- platformEffect.Container = View;
+ VisualElementRenderer<VisualElement>.RegisterEffect(effect, View);
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
index e2455d7..1c7730e 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
@@ -23,9 +23,7 @@ namespace Xamarin.Forms.Platform.iOS
void IEffectControlProvider.RegisterEffect(Effect effect)
{
- var platformEffect = effect as PlatformEffect;
- if (platformEffect != null)
- platformEffect.Container = View;
+ VisualElementRenderer<VisualElement>.RegisterEffect(effect, View);
}
public VisualElement Element { get; private set; }
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
index 501312c..b26e314 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
@@ -401,9 +401,7 @@ namespace Xamarin.Forms.Platform.iOS
void IEffectControlProvider.RegisterEffect(Effect effect)
{
- var platformEffect = effect as PlatformEffect;
- if (platformEffect != null)
- platformEffect.Container = View;
+ VisualElementRenderer<VisualElement>.RegisterEffect(effect, View);
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs
index 3d38bb6..c9c24ad 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ScrollViewRenderer.cs
@@ -6,7 +6,7 @@ using RectangleF = CoreGraphics.CGRect;
namespace Xamarin.Forms.Platform.iOS
{
- public class ScrollViewRenderer : UIScrollView, IVisualElementRenderer
+ public class ScrollViewRenderer : UIScrollView, IVisualElementRenderer, IEffectControlProvider
{
EventTracker _events;
KeyboardInsetTracker _insetTracker;
@@ -88,6 +88,8 @@ namespace Xamarin.Forms.Platform.iOS
OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));
+ EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);
+
if (element != null)
element.SendViewInitialized(this);
@@ -234,5 +236,10 @@ namespace Xamarin.Forms.Platform.iOS
if (ScrollView != null)
Controller.SetScrolledPosition(ContentOffset.X, ContentOffset.Y);
}
+
+ void IEffectControlProvider.RegisterEffect(Effect effect)
+ {
+ VisualElementRenderer<VisualElement>.RegisterEffect(effect, this, NativeView);
+ }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
index f0aa7c7..2749276 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
@@ -375,9 +375,7 @@ namespace Xamarin.Forms.Platform.iOS
void IEffectControlProvider.RegisterEffect(Effect effect)
{
- var platformEffect = effect as PlatformEffect;
- if (platformEffect != null)
- platformEffect.Container = View;
+ VisualElementRenderer<VisualElement>.RegisterEffect(effect, View);
}
void SetTabBarItem(IVisualElementRenderer renderer)
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
index 9f0dff0..fd03d46 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
@@ -388,9 +388,7 @@ namespace Xamarin.Forms.Platform.iOS
void IEffectControlProvider.RegisterEffect(Effect effect)
{
- var platformEffect = effect as PlatformEffect;
- if (platformEffect != null)
- platformEffect.Container = View;
+ VisualElementRenderer<VisualElement>.RegisterEffect(effect, View);
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
index 70c9bf6..390e16d 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs
@@ -7,7 +7,7 @@ using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Platform.iOS
{
- public class WebViewRenderer : UIWebView, IVisualElementRenderer, IWebViewDelegate
+ public class WebViewRenderer : UIWebView, IVisualElementRenderer, IWebViewDelegate, IEffectControlProvider
{
EventTracker _events;
bool _ignoreSourceChanges;
@@ -55,6 +55,8 @@ namespace Xamarin.Forms.Platform.iOS
OnElementChanged(new VisualElementChangedEventArgs(oldElement, element));
+ EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);
+
if (Element != null && !string.IsNullOrEmpty(Element.AutomationId))
AccessibilityIdentifier = Element.AutomationId;
@@ -260,5 +262,10 @@ namespace Xamarin.Forms.Platform.iOS
}
#endregion
+
+ void IEffectControlProvider.RegisterEffect(Effect effect)
+ {
+ VisualElementRenderer<VisualElement>.RegisterEffect(effect, this, NativeView);
+ }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs b/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs
index bb97185..155f8b6 100644
--- a/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs
@@ -73,6 +73,16 @@ namespace Xamarin.Forms.Platform.iOS
}
}
+ public static void RegisterEffect(Effect effect, UIView container, UIView control = null)
+ {
+ var platformEffect = effect as PlatformEffect;
+ if (platformEffect == null)
+ return;
+
+ platformEffect.Container = container;
+ platformEffect.Control = control;
+ }
+
void IEffectControlProvider.RegisterEffect(Effect effect)
{
var platformEffect = effect as PlatformEffect;