diff --git a/.gitignore b/.gitignore
index 10f16da..b0eb4b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
## files generated by popular Visual Studio add-ons.
.vs/
+mono_crash.*
# User-specific files
*.suo
diff --git a/README-ja.md b/README-ja.md
index 65d115b..b2e5467 100644
--- a/README-ja.md
+++ b/README-ja.md
@@ -657,8 +657,6 @@ ValueTextは使用できません。
iOSではタップ時にページ遷移し遷移先ページでピッカーが表示されます。
Androidではタップ時にダイアログでピッカーが表示されます。
-> PickerCellは、iOSのShell上では動作しません。
-
### Properties
* PageTitle
diff --git a/README.md b/README.md
index 9836c78..eb8b837 100644
--- a/README.md
+++ b/README.md
@@ -649,8 +649,6 @@ This is a LabelCell calling a multiple select picker.
When tapped on iOS, move next page and show picker there.
When tapped on Android, show the picker on a dialog.
-> Note that the PickerCell is not supported in Shell on iOS.
-
### Properties
* PageTitle
diff --git a/Sample/Sample/App.xaml.cs b/Sample/Sample/App.xaml.cs
index 704bfcf..1f99c23 100644
--- a/Sample/Sample/App.xaml.cs
+++ b/Sample/Sample/App.xaml.cs
@@ -22,7 +22,7 @@ protected override void OnInitialized()
NavigationService.NavigateAsync("MyNavigationPage/MainPage");
//MainPage = new AppShell();
- }
+ }
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
diff --git a/Sample/Sample/Properties/AssemblyInfo.cs b/Sample/Sample/Properties/AssemblyInfo.cs
index 017d48a..f4ed131 100644
--- a/Sample/Sample/Properties/AssemblyInfo.cs
+++ b/Sample/Sample/Properties/AssemblyInfo.cs
@@ -3,3 +3,4 @@
using Xamarin.Forms;
[assembly: ExportFont("APJapanesefont.ttf", Alias = "Anzu")]
+[assembly: ExportFont("icomoon.ttf", Alias = "Moon")]
\ No newline at end of file
diff --git a/Sample/Sample/Resources/icomoon.ttf b/Sample/Sample/Resources/icomoon.ttf
new file mode 100644
index 0000000..532def5
Binary files /dev/null and b/Sample/Sample/Resources/icomoon.ttf differ
diff --git a/Sample/Sample/Resources/ionicons.ttf b/Sample/Sample/Resources/ionicons.ttf
new file mode 100644
index 0000000..ffd7d6f
Binary files /dev/null and b/Sample/Sample/Resources/ionicons.ttf differ
diff --git a/Sample/Sample/Sample.csproj b/Sample/Sample/Sample.csproj
index 302654d..cebe9f1 100644
--- a/Sample/Sample/Sample.csproj
+++ b/Sample/Sample/Sample.csproj
@@ -1,10 +1,16 @@
- netstandard2.0
+ netstandard2.1
SettingsSample
+
+ 8.0
+
+
+ 8.0
+
@@ -22,9 +28,13 @@
+
+
+
+
\ No newline at end of file
diff --git a/Sample/Sample/Views/SettingsViewPage.xaml b/Sample/Sample/Views/SettingsViewPage.xaml
index 7fd73f0..3378a78 100644
--- a/Sample/Sample/Views/SettingsViewPage.xaml
+++ b/Sample/Sample/Views/SettingsViewPage.xaml
@@ -61,7 +61,7 @@
@@ -72,7 +72,14 @@
-
+
+
+
+
+
diff --git a/Sample/Sample/Views/ShellTestPage.xaml b/Sample/Sample/Views/ShellTestPage.xaml
index c6f6527..d4a9f48 100644
--- a/Sample/Sample/Views/ShellTestPage.xaml
+++ b/Sample/Sample/Views/ShellTestPage.xaml
@@ -3,11 +3,14 @@
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ai="clr-namespace:AiForms.Renderers;assembly=SettingsView"
- x:Class="Sample.Views.ShellTestPage">
-
+ x:Class="Sample.Views.ShellTestPage"
+ NavigationPage.BackButtonTitle=""
+ Title="ShellTest"
+ >
+
-
+
diff --git a/Sample/Sample/Views/SurveyPage.xaml b/Sample/Sample/Views/SurveyPage.xaml
index 0883506..40bd7f6 100644
--- a/Sample/Sample/Views/SurveyPage.xaml
+++ b/Sample/Sample/Views/SurveyPage.xaml
@@ -5,15 +5,7 @@
xmlns:sv="clr-namespace:AiForms.Renderers;assembly=SettingsView"
x:Class="Sample.Views.SurveyPage">
-
-
-
+
diff --git a/SettingsView.Droid/SettingsViewRecyclerAdapter.cs b/SettingsView.Droid/SettingsViewRecyclerAdapter.cs
index 3338b21..6f770a3 100644
--- a/SettingsView.Droid/SettingsViewRecyclerAdapter.cs
+++ b/SettingsView.Droid/SettingsViewRecyclerAdapter.cs
@@ -325,9 +325,16 @@ void BindHeaderView(HeaderViewHolder holder)
{
cellHeight = (int)_context.ToPixels(_settingsView.HeaderHeight);
}
+ else
+ {
+ cellHeight = -1; // Height Auto
+ }
- view.SetMinimumHeight(cellHeight);
- view.LayoutParameters.Height = cellHeight;
+ if (cellHeight >= 0)
+ {
+ view.SetMinimumHeight(cellHeight);
+ view.LayoutParameters.Height = cellHeight;
+ }
//textview setting
holder.TextView.SetPadding(
@@ -342,9 +349,11 @@ void BindHeaderView(HeaderViewHolder holder)
holder.TextView.Typeface = FontUtility.CreateTypeface(_settingsView.HeaderFontFamily, _settingsView.HeaderFontAttributes);
holder.TextView.SetTextSize(Android.Util.ComplexUnitType.Sp, (float)_settingsView.HeaderFontSize);
holder.TextView.SetBackgroundColor(_settingsView.HeaderBackgroundColor.ToAndroid());
- holder.TextView.SetMaxLines(1);
- holder.TextView.SetMinLines(1);
- holder.TextView.Ellipsize = TextUtils.TruncateAt.End;
+
+ // Single line was done away with.
+ //holder.TextView.SetMaxLines(1);
+ //holder.TextView.SetMinLines(1);
+ //holder.TextView.Ellipsize = TextUtils.TruncateAt.End;
if (_settingsView.HeaderTextColor != Xamarin.Forms.Color.Default)
{
diff --git a/SettingsView.iOS/Cells/CellBaseView.cs b/SettingsView.iOS/Cells/CellBaseView.cs
index 2647bb2..37925b1 100644
--- a/SettingsView.iOS/Cells/CellBaseView.cs
+++ b/SettingsView.iOS/Cells/CellBaseView.cs
@@ -7,6 +7,7 @@
using Xamarin.Forms.Platform.iOS;
using Foundation;
using CoreGraphics;
+using CoreFoundation;
namespace AiForms.Renderers.iOS
{
@@ -514,7 +515,16 @@ void LoadIconImage(IImageSourceHandler handler, ImageSource source)
var scale = (float)UIScreen.MainScreen.Scale;
Task.Run(async () =>
{
- image = await handler.LoadImageAsync(source, token, scale: scale);
+ if(source is FontImageSource)
+ {
+ DispatchQueue.MainQueue.DispatchSync(async () => {
+ image = await handler.LoadImageAsync(source, token, scale: scale);
+ });
+ }
+ else
+ {
+ image = await handler.LoadImageAsync(source, token, scale: scale);
+ }
token.ThrowIfCancellationRequested();
}, token).ContinueWith(t =>
{
diff --git a/SettingsView.iOS/Cells/PickerCellRenderer.cs b/SettingsView.iOS/Cells/PickerCellRenderer.cs
index 4f2be4b..a97dd99 100644
--- a/SettingsView.iOS/Cells/PickerCellRenderer.cs
+++ b/SettingsView.iOS/Cells/PickerCellRenderer.cs
@@ -1,12 +1,12 @@
-using AiForms.Renderers;
+using System.Collections.Specialized;
+using System.Linq;
+using AiForms.Renderers;
using AiForms.Renderers.iOS;
+using Foundation;
+using ObjCRuntime;
using UIKit;
using Xamarin.Forms;
-using System.Collections.Specialized;
-using System;
-using Foundation;
-using System.Linq;
-using System.ComponentModel;
+using Xamarin.Forms.Platform.iOS;
[assembly: ExportRenderer(typeof(PickerCell), typeof(PickerCellRenderer))]
namespace AiForms.Renderers.iOS
@@ -82,10 +82,34 @@ public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
return;
}
- var naviCtrl = GetUINavigationController(UIApplication.SharedApplication.KeyWindow.RootViewController);
_pickerVC?.Dispose();
- _pickerVC = new PickerTableViewController(this, tableView);
- BeginInvokeOnMainThread(() => naviCtrl.PushViewController(_pickerVC, true));
+
+ var naviCtrl = GetUINavigationController(UIApplication.SharedApplication.KeyWindow.RootViewController);
+ if(naviCtrl is ShellSectionRenderer shell)
+ {
+ // When use Shell, the NativeView is wrapped in a Forms.ContentPage.
+ _pickerVC = new PickerTableViewController(this, tableView, shell.ShellSection.Navigation);
+ // Fix height broken. For some reason, TableView ContentSize is broken.
+ _pickerVC.TableView.ContentInset = new UIEdgeInsets(44, 0, 44, 0);
+ var page = new ContentPage();
+ page.Content = _pickerVC.TableView.ToView(); ;
+ page.Title = _PickerCell.PageTitle;
+
+ // Fire manually because INavigation.PushAsync does not work ViewDidAppear and ViewWillAppear.
+ _pickerVC.ViewDidAppear(false);
+ _pickerVC.InitializeView();
+ BeginInvokeOnMainThread(async () => {
+ await shell.ShellSection.Navigation.PushAsync(page, true);
+ _pickerVC.InitializeScroll();
+ });
+ }
+ else
+ {
+ // When use traditional navigation.
+ _pickerVC = new PickerTableViewController(this, tableView);
+ BeginInvokeOnMainThread(() => naviCtrl.PushViewController(_pickerVC, true));
+ }
+
if (!_PickerCell.KeepSelectedUntilBack)
{
@@ -93,6 +117,25 @@ public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
}
}
+ class NavDelegate : UINavigationControllerDelegate
+ {
+ readonly ShellSectionRenderer _self;
+
+ public NavDelegate(ShellSectionRenderer renderer)
+ {
+ _self = renderer;
+ }
+
+ public override void DidShowViewController(UINavigationController navigationController, [Transient] UIViewController viewController, bool animated)
+ {
+ }
+
+ public override void WillShowViewController(UINavigationController navigationController, [Transient] UIViewController viewController, bool animated)
+ {
+ navigationController.SetNavigationBarHidden(false, true);
+ }
+ }
+
///
/// Updates the cell.
///
diff --git a/SettingsView.iOS/Cells/PickerTableViewController.cs b/SettingsView.iOS/Cells/PickerTableViewController.cs
index ea82ac1..eba31a3 100644
--- a/SettingsView.iOS/Cells/PickerTableViewController.cs
+++ b/SettingsView.iOS/Cells/PickerTableViewController.cs
@@ -4,6 +4,7 @@
using System.Linq;
using Foundation;
using UIKit;
+using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
namespace AiForms.Renderers.iOS
@@ -24,25 +25,27 @@ internal class PickerTableViewController : UITableViewController
nfloat _detailFontSize;
UIColor _background;
UITableView _tableView;
+ INavigation _shellNavigation;
- internal PickerTableViewController(PickerCellView pickerCellView, UITableView tableView):base(UITableViewStyle.Grouped)
+ internal PickerTableViewController(PickerCellView pickerCellView, UITableView tableView,INavigation shellNavigation = null):base(UITableViewStyle.Grouped)
{
_pickerCell = pickerCellView.Cell as PickerCell;
_pickerCellNative = pickerCellView;
_parent = pickerCellView.CellParent;
_source = _pickerCell.ItemsSource as IList;
_tableView = tableView;
+ _shellNavigation = shellNavigation;
if (_pickerCell.SelectedItems == null) {
_pickerCell.SelectedItems = new List