diff options
author | Samantha Houts <samantha@teamredwall.com> | 2016-04-11 18:05:28 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-04-11 18:05:28 -0700 |
commit | 90d8976cfdadc1582e366c0b6f6611d6fe83f5ff (patch) | |
tree | e2ebd71214c4855ec5862d9c2c13f3a90051ae31 /Xamarin.Forms.Platform.iOS | |
parent | df2427091536ed8065e50f7bffebbc5707971803 (diff) | |
download | xamarin-forms-90d8976cfdadc1582e366c0b6f6611d6fe83f5ff.tar.gz xamarin-forms-90d8976cfdadc1582e366c0b6f6611d6fe83f5ff.tar.bz2 xamarin-forms-90d8976cfdadc1582e366c0b6f6611d6fe83f5ff.zip |
[iOS] Resolve Warning 0108 (#64)
[iOS] Resolve warning 0114
`Selected` is overridable, but current behavior is to hide it, so we're
going to add the `new` keyword.
[iOS] Resolve warning 0618
[iOS] Resolve warning 0414, 0649, 0169
[iOS] Resolve warning 0105
Update dispose to override base dispose (#67)
Add an optional extended description…
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
12 files changed, 63 insertions, 75 deletions
diff --git a/Xamarin.Forms.Platform.iOS/ContextScrollViewDelegate.cs b/Xamarin.Forms.Platform.iOS/ContextScrollViewDelegate.cs index 47ce0714..b2b34e4a 100644 --- a/Xamarin.Forms.Platform.iOS/ContextScrollViewDelegate.cs +++ b/Xamarin.Forms.Platform.iOS/ContextScrollViewDelegate.cs @@ -178,7 +178,7 @@ namespace Xamarin.Forms.Platform.iOS if (table != null) { _table = table; - _globalCloser = new GlobalCloseContextGestureRecognizer(scrollView, _buttons, close); + _globalCloser = new GlobalCloseContextGestureRecognizer(scrollView, close); _globalCloser.ShouldRecognizeSimultaneously = (recognizer, r) => r == _table.PanGestureRecognizer; table.AddGestureRecognizer(_globalCloser); diff --git a/Xamarin.Forms.Platform.iOS/GlobalCloseContextGestureRecognizer.cs b/Xamarin.Forms.Platform.iOS/GlobalCloseContextGestureRecognizer.cs index fa76b982..f0e8522b 100644 --- a/Xamarin.Forms.Platform.iOS/GlobalCloseContextGestureRecognizer.cs +++ b/Xamarin.Forms.Platform.iOS/GlobalCloseContextGestureRecognizer.cs @@ -22,13 +22,11 @@ namespace Xamarin.Forms.Platform.iOS { internal class GlobalCloseContextGestureRecognizer : UIGestureRecognizer { - List<UIButton> _buttons; UIScrollView _scrollView; - public GlobalCloseContextGestureRecognizer(UIScrollView scrollView, List<UIButton> buttons, NSAction activated) : base(activated) + public GlobalCloseContextGestureRecognizer(UIScrollView scrollView, NSAction activated) : base(activated) { _scrollView = scrollView; - _buttons = buttons; ShouldReceiveTouch = OnShouldReceiveTouch; } @@ -57,7 +55,6 @@ namespace Xamarin.Forms.Platform.iOS if (disposing) { - _buttons = null; _scrollView = null; } } diff --git a/Xamarin.Forms.Platform.iOS/Platform.cs b/Xamarin.Forms.Platform.iOS/Platform.cs index 0293e75f..3022fa0e 100644 --- a/Xamarin.Forms.Platform.iOS/Platform.cs +++ b/Xamarin.Forms.Platform.iOS/Platform.cs @@ -5,32 +5,28 @@ using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using System.Threading.Tasks; + #if __UNIFIED__ using CoreGraphics; using Foundation; using ObjCRuntime; using UIKit; +using RectangleF = CoreGraphics.CGRect; +using SizeF = CoreGraphics.CGSize; +using PointF = CoreGraphics.CGPoint; + #else using MonoTouch; using MonoTouch.CoreAnimation; using MonoTouch.CoreFoundation; using MonoTouch.CoreGraphics; using MonoTouch.UIKit; -using System.Drawing; -using MonoTouch.CoreAnimation; using MonoTouch.Foundation; using MonoTouch.ObjCRuntime; -using MonoTouch.UIKit; -#endif -#if __UNIFIED__ -using RectangleF = CoreGraphics.CGRect; -using SizeF = CoreGraphics.CGSize; -using PointF = CoreGraphics.CGPoint; -#else -using nfloat=System.Single; -using nint=System.Int32; -using nuint=System.UInt32; +using nfloat = System.Single; +using nint = System.Int32; +using nuint = System.UInt32; #endif namespace Xamarin.Forms.Platform.iOS diff --git a/Xamarin.Forms.Platform.iOS/Renderers/CarouselViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/CarouselViewRenderer.cs index 84f57a91..3efb316b 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/CarouselViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/CarouselViewRenderer.cs @@ -46,7 +46,6 @@ namespace Xamarin.Forms.Platform.iOS { #region Static Fields const int DefaultMinimumDimension = 44; - static readonly UIColor DefaultBackgroundColor = UIColor.White; #endregion #region Fields @@ -248,11 +247,11 @@ namespace Xamarin.Forms.Platform.iOS void Bind(object item, int position) { - //if (position != this.position) - // controller.SendPositionDisappearing (this.position); + //if (position != this._position) + // controller.SendPositionDisappearing (this._position); _position = position; - OnBind?.Invoke(position); + OnBind?.Invoke(_position); _controller.BindView(_view, item); } @@ -274,7 +273,7 @@ namespace Xamarin.Forms.Platform.iOS _view = controller.CreateView(itemType); // bind view - Bind(item, position); + Bind(item, _position); // render view _renderer = Platform.CreateRenderer(_view); @@ -285,7 +284,7 @@ namespace Xamarin.Forms.Platform.iOS ContentView.AddSubview(uiView); } else - Bind(item, position); + Bind(item, _position); } public Action<int> OnBind; diff --git a/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs b/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs index b2410018..c2e565d9 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs @@ -196,10 +196,11 @@ namespace Xamarin.Forms.Platform.iOS _size = size; _attributes = attributes; } - +#pragma warning disable 0414 // these are not called explicitly, but they are used to establish uniqueness. allow it! string _family; float _size; FontAttributes _attributes; +#pragma warning restore 0414 } } }
\ No newline at end of file diff --git a/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs b/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs index 89a09e86..4bb829b5 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/FormattedStringExtensions.cs @@ -16,10 +16,9 @@ namespace Xamarin.Forms.Platform.iOS if (span == null) return null; -#pragma warning disable 618 +#pragma warning disable 0618 //retaining legacy call to obsolete code var font = span.Font != Font.Default ? span.Font : defaultFont; -#pragma warning restore 618 - +#pragma warning restore 0618 var fgcolor = span.ForegroundColor; if (fgcolor.IsDefault) fgcolor = defaultForegroundColor; diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs index b3269927..aa9b5ff3 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs @@ -89,7 +89,7 @@ namespace Xamarin.Forms.Platform.iOS set { _nameLabel.Text = value; } } - public Action Selected { get; set; } + public new Action Selected { get; set; } public override void LayoutSubviews() { diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs index 74e7fdd6..ca690eed 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs @@ -435,9 +435,9 @@ namespace Xamarin.Forms.Platform.iOS void HandlePropertyChanged(object sender, PropertyChangedEventArgs e) { -#pragma warning disable 618 +#pragma warning disable 0618 //retaining legacy call to obsolete code if (e.PropertyName == NavigationPage.TintProperty.PropertyName) -#pragma warning restore 618 +#pragma warning restore 0618 UpdateTint(); if (e.PropertyName == NavigationPage.BarBackgroundColorProperty.PropertyName) UpdateBarBackgroundColor(); @@ -645,10 +645,9 @@ namespace Xamarin.Forms.Platform.iOS void UpdateTint() { -#pragma warning disable 618 +#pragma warning disable 0618 //retaining legacy call to obsolete code var tintColor = ((NavigationPage)Element).Tint; -#pragma warning restore 618 - +#pragma warning restore 0618 if (Forms.IsiOS7OrNewer) { NavigationBar.BarTintColor = tintColor == Color.Default ? UINavigationBar.Appearance.BarTintColor : tintColor.ToUIColor(); diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs index 3561322c..6bf2aa86 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs @@ -69,37 +69,38 @@ namespace Xamarin.Forms.Platform.iOS get { return _innerDelegate == null ? null : _innerDelegate.PresentButton; } } - public void Dispose() + protected override void Dispose(bool disposing) { - if (_disposed) - return; - - if (Element != null) - { - ((Page)Element).SendDisappearing(); - Element.PropertyChanged -= HandlePropertyChanged; - Element = null; - } - - if (_tracker != null) - { - _tracker.Dispose(); - _tracker = null; - } - - if (_events != null) - { - _events.Dispose(); - _events = null; - } - - if (_masterController != null) - { - _masterController.WillAppear -= MasterControllerWillAppear; - _masterController.WillDisappear -= MasterControllerWillDisappear; - } - - _disposed = true; + if (!_disposed && disposing) + { + if (Element != null) + { + ((Page)Element).SendDisappearing(); + Element.PropertyChanged -= HandlePropertyChanged; + Element = null; + } + + if (_tracker != null) + { + _tracker.Dispose(); + _tracker = null; + } + + if (_events != null) + { + _events.Dispose(); + _events = null; + } + + if (_masterController != null) + { + _masterController.WillAppear -= MasterControllerWillAppear; + _masterController.WillDisappear -= MasterControllerWillDisappear; + } + + _disposed = true; + } + base.Dispose(disposing); } public VisualElement Element { get; private set; } diff --git a/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs index 538bc2d0..0c6c639b 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/WebViewRenderer.cs @@ -19,8 +19,6 @@ namespace Xamarin.Forms.Platform.iOS WebNavigationEvent _lastBackForwardEvent; VisualElementPackager _packager; - VisualElementTracker _tracker; - public WebViewRenderer() : base(RectangleF.Empty) { } @@ -49,8 +47,6 @@ namespace Xamarin.Forms.Platform.iOS AutosizesSubviews = true; AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; - _tracker = new VisualElementTracker(this); - _packager = new VisualElementPackager(this); _packager.Load(); diff --git a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj index 592c95eb..d8679944 100644 --- a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj +++ b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.Classic.csproj @@ -25,7 +25,7 @@ <MtouchDebug>true</MtouchDebug> <CodesignKey>iPhone Developer</CodesignKey> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <NoWarn>0169;0114;0108;0105;0414;0649</NoWarn> + <NoWarn></NoWarn> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>none</DebugType> @@ -38,7 +38,7 @@ <CodesignKey>iPhone Developer</CodesignKey> <DefineConstants>TRACE;__IOS__;__MOBILE__;</DefineConstants> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <NoWarn>0169;0114;0108;0105;0414;0649</NoWarn> + <NoWarn></NoWarn> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'"> <DebugSymbols>true</DebugSymbols> @@ -50,11 +50,11 @@ <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <NoWarn>0169;0114;0108;0105;0414;0649</NoWarn> + <NoWarn></NoWarn> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'AppStore|AnyCPU'"> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <NoWarn>0169;0114;0108;0105;0414;0649</NoWarn> + <NoWarn></NoWarn> </PropertyGroup> <ItemGroup> <Compile Include="..\Xamarin.Forms.Core\Properties\GlobalAssemblyInfo.cs"> diff --git a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj index 48b816bb..5c75adf0 100644 --- a/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj +++ b/Xamarin.Forms.Platform.iOS/Xamarin.Forms.Platform.iOS.csproj @@ -20,7 +20,7 @@ <WarningLevel>4</WarningLevel> <ConsolePause>false</ConsolePause> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <NoWarn>0108;0114;0414;0649</NoWarn> + <NoWarn></NoWarn> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>full</DebugType> @@ -30,7 +30,7 @@ <WarningLevel>4</WarningLevel> <ConsolePause>false</ConsolePause> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <NoWarn>0108;0114;0414;0649</NoWarn> + <NoWarn></NoWarn> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'"> <DebugSymbols>true</DebugSymbols> @@ -42,11 +42,11 @@ <ErrorReport>prompt</ErrorReport> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <NoWarn>0108;0114;0414;0649</NoWarn> + <NoWarn></NoWarn> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'AppStore|AnyCPU'"> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> - <NoWarn>0108;0114;0414;0649</NoWarn> + <NoWarn></NoWarn> </PropertyGroup> <ItemGroup> <Reference Include="System" /> |