summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS/Renderers
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers')
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs26
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs10
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs16
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs10
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs57
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs12
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs29
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TableViewRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs12
13 files changed, 36 insertions, 152 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs
index 8d043bac..68d4702d 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs
@@ -82,8 +82,6 @@ namespace Xamarin.Forms.Platform.iOS
UpdateFont();
else if (e.PropertyName == Button.BorderWidthProperty.PropertyName || e.PropertyName == Button.BorderRadiusProperty.PropertyName || e.PropertyName == Button.BorderColorProperty.PropertyName)
UpdateBorder();
- else if (e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName)
- UpdateBackgroundVisibility();
else if (e.PropertyName == Button.ImageProperty.PropertyName)
UpdateImage();
}
@@ -93,18 +91,6 @@ namespace Xamarin.Forms.Platform.iOS
((IButtonController)Element)?.SendClicked();
}
- void UpdateBackgroundVisibility()
- {
- if (Forms.IsiOS7OrNewer)
- return;
-
- var model = Element;
- var shouldDrawImage = model.BackgroundColor == Color.Default;
-
- foreach (var control in Control.Subviews.Where(sv => !(sv is UILabel)))
- control.Alpha = shouldDrawImage ? 1.0f : 0.0f;
- }
-
void UpdateBorder()
{
var uiButton = Control;
@@ -115,8 +101,6 @@ namespace Xamarin.Forms.Platform.iOS
uiButton.Layer.BorderWidth = Math.Max(0f, (float)button.BorderWidth);
uiButton.Layer.CornerRadius = button.BorderRadius;
-
- UpdateBackgroundVisibility();
}
void UpdateFont()
@@ -142,10 +126,7 @@ namespace Xamarin.Forms.Platform.iOS
UIButton button = Control;
if (button != null && uiimage != null)
{
- if (Forms.IsiOS7OrNewer)
- button.SetImage(uiimage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);
- else
- button.SetImage(uiimage, UIControlState.Normal);
+ button.SetImage(uiimage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);
button.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
@@ -184,9 +165,8 @@ namespace Xamarin.Forms.Platform.iOS
Control.SetTitleColor(Element.TextColor.ToUIColor(), UIControlState.Normal);
Control.SetTitleColor(Element.TextColor.ToUIColor(), UIControlState.Highlighted);
Control.SetTitleColor(_buttonTextColorDefaultDisabled, UIControlState.Disabled);
-
- if (Forms.IsiOS7OrNewer)
- Control.TintColor = Element.TextColor.ToUIColor();
+
+ Control.TintColor = Element.TextColor.ToUIColor();
}
}
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
index 58587e83..f1364de7 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/CarouselPageRenderer.cs
@@ -22,8 +22,6 @@ namespace Xamarin.Forms.Platform.iOS
public CarouselPageRenderer()
{
- if (!Forms.IsiOS7OrNewer)
- WantsFullScreenLayout = true;
}
IElementController ElementController => Element as IElementController;
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
index 8819ba33..c92ccb4b 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/EditorRenderer.cs
@@ -11,16 +11,6 @@ namespace Xamarin.Forms.Platform.iOS
IElementController ElementController => Element as IElementController;
- public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
- {
- if (!Forms.IsiOS7OrNewer)
- {
- // Avoid crash iOS 6. iOS 6, I hate you. Why you no like Infinite size?
- return base.GetDesiredSize(Math.Min(widthConstraint, 2000), Math.Min(heightConstraint, 2000));
- }
- return base.GetDesiredSize(widthConstraint, heightConstraint);
- }
-
protected override void Dispose(bool disposing)
{
if (disposing)
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs b/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs
index ae16c662..cbc2e625 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/FontExtensions.cs
@@ -41,7 +41,7 @@ namespace Xamarin.Forms.Platform.iOS
{
try
{
- if (UIFont.FamilyNames.Contains(self.FontFamily) && Forms.IsiOS7OrNewer)
+ if (UIFont.FamilyNames.Contains(self.FontFamily))
{
var descriptor = new UIFontDescriptor().CreateWithFamily(self.FontFamily);
@@ -67,12 +67,6 @@ namespace Xamarin.Forms.Platform.iOS
}
if (bold && italic)
{
- if (!Forms.IsiOS7OrNewer)
- {
- // not sure how to make a font both bold and italic in iOS 6, default to bold
- return UIFont.BoldSystemFontOfSize(size);
- }
-
var defaultFont = UIFont.SystemFontOfSize(size);
var descriptor = defaultFont.FontDescriptor.CreateWithTraits(UIFontDescriptorSymbolicTraits.Bold | UIFontDescriptorSymbolicTraits.Italic);
return UIFont.FromDescriptor(descriptor, 0);
@@ -110,7 +104,7 @@ namespace Xamarin.Forms.Platform.iOS
try
{
UIFont result;
- if (UIFont.FamilyNames.Contains(family) && Forms.IsiOS7OrNewer)
+ if (UIFont.FamilyNames.Contains(family))
{
var descriptor = new UIFontDescriptor().CreateWithFamily(family);
@@ -143,12 +137,6 @@ namespace Xamarin.Forms.Platform.iOS
{
var defaultFont = UIFont.SystemFontOfSize(size);
- if (!Forms.IsiOS7OrNewer)
- {
- // not sure how to make a font both bold and italic in iOS 6, default to bold
- return UIFont.BoldSystemFontOfSize(size);
- }
-
var descriptor = defaultFont.FontDescriptor.CreateWithTraits(UIFontDescriptorSymbolicTraits.Bold | UIFontDescriptorSymbolicTraits.Italic);
return UIFont.FromDescriptor(descriptor, 0);
}
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
index 89001cc8..2c0ac91a 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
@@ -373,8 +373,7 @@ namespace Xamarin.Forms.Platform.iOS
}
else
{
- if (Forms.IsiOS7OrNewer)
- Control.EstimatedRowHeight = 0;
+ Control.EstimatedRowHeight = 0;
_estimatedRowHeight = true;
}
}
@@ -644,10 +643,7 @@ namespace Xamarin.Forms.Platform.iOS
if (List.RowHeight == -1 && cell.Height == -1 && cell is ViewCell)
{
- // only doing ViewCell because its the only one that matters (the others dont adjust ANYWAY)
- if (Forms.IsiOS8OrNewer)
- return UITableView.AutomaticDimension;
- return CalculateHeightForCell(tableView, cell);
+ return UITableView.AutomaticDimension;
}
var renderHeight = cell.RenderHeight;
@@ -713,7 +709,7 @@ namespace Xamarin.Forms.Platform.iOS
{
_uiTableViewController = uiTableViewController;
_uiTableView = uiTableViewController.TableView;
- _defaultSectionHeight = Forms.IsiOS8OrNewer ? DefaultRowHeight : _uiTableView.SectionHeaderHeight;
+ _defaultSectionHeight = DefaultRowHeight;
List = list;
List.ItemSelected += OnItemSelected;
UpdateShortNameListener();
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
index adf32192..55e39ada 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs
@@ -182,13 +182,7 @@ namespace Xamarin.Forms.Platform.iOS
{
base.ViewDidLoad();
- if (Forms.IsiOS7OrNewer)
- {
-
- UpdateTranslucent();
- }
- else
- WantsFullScreenLayout = false;
+ UpdateTranslucent();
_secondaryToolbar = new SecondaryToolbar { Frame = new RectangleF(0, 0, 320, 44) };
View.Add(_secondaryToolbar);
@@ -454,11 +448,6 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateTranslucent()
{
- if (!Forms.IsiOS7OrNewer)
- {
- return;
- }
-
NavigationBar.Translucent = ((NavigationPage)Element).OnThisPlatform().IsNavigationBarTranslucent();
}
@@ -571,18 +560,9 @@ namespace Xamarin.Forms.Platform.iOS
{
var barBackgroundColor = ((NavigationPage)Element).BarBackgroundColor;
// Set navigation bar background color
- if (Forms.IsiOS7OrNewer)
- {
- NavigationBar.BarTintColor = barBackgroundColor == Color.Default
- ? UINavigationBar.Appearance.BarTintColor
- : barBackgroundColor.ToUIColor();
- }
- else
- {
- NavigationBar.TintColor = barBackgroundColor == Color.Default
- ? UINavigationBar.Appearance.TintColor
- : barBackgroundColor.ToUIColor();
- }
+ NavigationBar.BarTintColor = barBackgroundColor == Color.Default
+ ? UINavigationBar.Appearance.BarTintColor
+ : barBackgroundColor.ToUIColor();
}
void UpdateBarTextColor()
@@ -616,12 +596,9 @@ namespace Xamarin.Forms.Platform.iOS
var statusBarColorMode = (Element as NavigationPage).OnThisPlatform().GetStatusBarTextColorMode();
// set Tint color (i. e. Back Button arrow and Text)
- if (Forms.IsiOS7OrNewer)
- {
- NavigationBar.TintColor = barTextColor == Color.Default || statusBarColorMode == StatusBarTextColorMode.DoNotAdjust
- ? UINavigationBar.Appearance.TintColor
- : barTextColor.ToUIColor();
- }
+ NavigationBar.TintColor = barTextColor == Color.Default || statusBarColorMode == StatusBarTextColorMode.DoNotAdjust
+ ? UINavigationBar.Appearance.TintColor
+ : barTextColor.ToUIColor();
if (statusBarColorMode == StatusBarTextColorMode.DoNotAdjust || barTextColor.Luminosity <= 0.5)
{
@@ -679,18 +656,13 @@ namespace Xamarin.Forms.Platform.iOS
#pragma warning disable 0618 //retaining legacy call to obsolete code
var tintColor = ((NavigationPage)Element).Tint;
#pragma warning restore 0618
- if (Forms.IsiOS7OrNewer)
- {
- NavigationBar.BarTintColor = tintColor == Color.Default
- ? UINavigationBar.Appearance.BarTintColor
- : tintColor.ToUIColor();
- if (tintColor == Color.Default)
- NavigationBar.TintColor = UINavigationBar.Appearance.TintColor;
- else
- NavigationBar.TintColor = tintColor.Luminosity > 0.5 ? UIColor.Black : UIColor.White;
- }
+ NavigationBar.BarTintColor = tintColor == Color.Default
+ ? UINavigationBar.Appearance.BarTintColor
+ : tintColor.ToUIColor();
+ if (tintColor == Color.Default)
+ NavigationBar.TintColor = UINavigationBar.Appearance.TintColor;
else
- NavigationBar.TintColor = tintColor == Color.Default ? null : tintColor.ToUIColor();
+ NavigationBar.TintColor = tintColor.Luminosity > 0.5 ? UIColor.Black : UIColor.White;
}
void UpdateToolBarVisible()
@@ -776,8 +748,7 @@ namespace Xamarin.Forms.Platform.iOS
public ParentingViewController(NavigationRenderer navigation)
{
- if (Forms.IsiOS7OrNewer)
- AutomaticallyAdjustsScrollViewInsets = false;
+ AutomaticallyAdjustsScrollViewInsets = false;
_navigation = new WeakReference<NavigationRenderer>(navigation);
}
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
index 1f7408b7..e2455d78 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PageRenderer.cs
@@ -19,8 +19,6 @@ namespace Xamarin.Forms.Platform.iOS
public PageRenderer()
{
- if (!Forms.IsiOS7OrNewer)
- WantsFullScreenLayout = true;
}
void IEffectControlProvider.RegisterEffect(Effect effect)
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
index 627bec7f..501312cd 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
@@ -28,8 +28,6 @@ namespace Xamarin.Forms.Platform.iOS
public PhoneMasterDetailRenderer()
{
- if (!Forms.IsiOS7OrNewer)
- WantsFullScreenLayout = true;
}
IMasterDetailPageController MasterDetailPageController => Element as IMasterDetailPageController;
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
index 8c54702f..96fb0207 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/SearchBarRenderer.cs
@@ -107,16 +107,10 @@ namespace Xamarin.Forms.Platform.iOS
if (_defaultTintColor == null)
{
- if (Forms.IsiOS7OrNewer)
- _defaultTintColor = Control.BarTintColor;
- else
- _defaultTintColor = Control.TintColor;
+ _defaultTintColor = Control.BarTintColor;
}
-
- if (Forms.IsiOS7OrNewer)
- Control.BarTintColor = color.ToUIColor(_defaultTintColor);
- else
- Control.TintColor = color.ToUIColor(_defaultTintColor);
+
+ Control.BarTintColor = color.ToUIColor(_defaultTintColor);
if (color.A < 1)
Control.SetBackgroundImage(new UIImage(), UIBarPosition.Any, UIBarMetrics.Default);
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
index c6c07370..f0aa7c7f 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs
@@ -134,14 +134,6 @@ namespace Xamarin.Forms.Platform.iOS
_loaded = true;
}
- public override void ViewDidLoad()
- {
- base.ViewDidLoad();
-
- if (!Forms.IsiOS7OrNewer)
- WantsFullScreenLayout = false;
- }
-
protected override void Dispose(bool disposing)
{
if (disposing)
@@ -314,25 +306,15 @@ namespace Xamarin.Forms.Platform.iOS
if (!_defaultBarColorSet)
{
- if (Forms.IsiOS7OrNewer)
- _defaultBarColor = TabBar.BarTintColor;
- else
- _defaultBarColor = TabBar.TintColor;
+ _defaultBarColor = TabBar.BarTintColor;
_defaultBarColorSet = true;
}
if (!isDefaultColor)
_barBackgroundColorWasSet = true;
-
- if (Forms.IsiOS7OrNewer)
- {
- TabBar.BarTintColor = isDefaultColor ? _defaultBarColor : barBackgroundColor.ToUIColor();
- }
- else
- {
- TabBar.TintColor = isDefaultColor ? _defaultBarColor : barBackgroundColor.ToUIColor();
- }
+
+ TabBar.BarTintColor = isDefaultColor ? _defaultBarColor : barBackgroundColor.ToUIColor();
}
void UpdateBarTextColor()
@@ -369,10 +351,7 @@ namespace Xamarin.Forms.Platform.iOS
// set TintColor for selected icon
// setting the unselected icon tint is not supported by iOS
- if (Forms.IsiOS7OrNewer)
- {
- TabBar.TintColor = isDefaultColor ? _defaultBarTextColor : barTextColor.ToUIColor();
- }
+ TabBar.TintColor = isDefaultColor ? _defaultBarTextColor : barTextColor.ToUIColor();
}
void UpdateChildrenOrderIndex(UIViewController[] viewControllers)
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
index 4a9f694d..b8a6fc95 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TableViewModelRenderer.cs
@@ -137,7 +137,7 @@ namespace Xamarin.Forms.Platform.iOS
var cell = View.Model.GetCell(indexPath.Section, indexPath.Row);
var h = cell.Height;
- if (View.RowHeight == -1 && h == -1 && cell is ViewCell && Forms.IsiOS8OrNewer) {
+ if (View.RowHeight == -1 && h == -1 && cell is ViewCell) {
return UITableView.AutomaticDimension;
} else if (h == -1)
return tableView.RowHeight;
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TableViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TableViewRenderer.cs
index 725ef51f..f6008f64 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TableViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TableViewRenderer.cs
@@ -134,9 +134,8 @@ namespace Xamarin.Forms.Platform.iOS
void UpdateRowHeight()
{
var rowHeight = Element.RowHeight;
- if (Element.HasUnevenRows && rowHeight == -1 && Forms.IsiOS7OrNewer) {
- if (Forms.IsiOS8OrNewer)
- Control.RowHeight = UITableView.AutomaticDimension;
+ if (Element.HasUnevenRows && rowHeight == -1) {
+ Control.RowHeight = UITableView.AutomaticDimension;
} else
Control.RowHeight = rowHeight <= 0 ? DefaultRowHeight : rowHeight;
}
@@ -147,8 +146,7 @@ namespace Xamarin.Forms.Platform.iOS
if (Element.HasUnevenRows && rowHeight == -1) {
Control.EstimatedRowHeight = DefaultRowHeight;
} else {
- if (Forms.IsiOS7OrNewer)
- Control.EstimatedRowHeight = 0;
+ Control.EstimatedRowHeight = 0;
}
}
}
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
index e72b243b..9f0dff00 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/TabletMasterDetailRenderer.cs
@@ -223,11 +223,8 @@ namespace Xamarin.Forms.Platform.iOS
if (!MasterDetailPageController.ShouldShowSplitMode && _masterVisible)
{
MasterDetailPageController.CanChangeIsPresented = true;
- if (Forms.IsiOS8OrNewer)
- {
- PreferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden;
- PreferredDisplayMode = UISplitViewControllerDisplayMode.Automatic;
- }
+ PreferredDisplayMode = UISplitViewControllerDisplayMode.PrimaryHidden;
+ PreferredDisplayMode = UISplitViewControllerDisplayMode.Automatic;
}
MasterDetailPageController.UpdateMasterBehavior();
@@ -307,10 +304,7 @@ namespace Xamarin.Forms.Platform.iOS
void PerformButtonSelector()
{
- if (Forms.IsiOS8OrNewer)
- DisplayModeButtonItem.Target.PerformSelector(DisplayModeButtonItem.Action, DisplayModeButtonItem, 0);
- else
- PresentButton.Target.PerformSelector(PresentButton.Action, PresentButton, 0);
+ DisplayModeButtonItem.Target.PerformSelector(DisplayModeButtonItem.Action, DisplayModeButtonItem, 0);
}
void ToggleMaster()