Ui not showing in Xamarin.iOS
Opened this issue · 10 comments
Calling var response = await CrossTEditor.Current.ShowTEditor("<strong>TESTING</strong><p>yolo</p>");
in a Xamarin.iOS app does nothing. No UI is shown, and the await
call never comes back. Any ideas?
@rusty21 its basically the same thing on Android I'm not sure if this is being maintained anymore
I cannot reproduce this in Sample. Can you try this in Sample project?
The problem stems from the fact that my root view controller is a navigation controller which isn't handled currently. In this file
https://github.com/XAM-Consulting/TEditor/blob/master/iOS/TEditorImplementation.cs
you are only checking if any of the child view controllers are navigation controllers, not the actual root itself. That should solve the problem. Also I would consider adding some code that throws an exception saying that there was no navigation controller found so no view could be shown. That way the programmer knows that somewhere they need a navigation controller.
Im also have same problem. did you fixed it?
We ended up dropping some requirements that caused us to seek out this library. However, Its a relatively simple fix. I downloaded the source for the project, included all the code in my project, then I debugged the TEditor library to find where things were going wrong. Turns out it was in this file https://github.com/XAM-Consulting/TEditor/blob/master/iOS/TEditorImplementation.cs the change was relatively trivial. I'm assuming you'll just have to modify this file to work with the navigation in your project.
@rusty21 thanks mate!!!
I wish i could get rid of html text funny business the from the project req. but no luck ;)
i'll look into that.
Same Problem I was faced in Xamarin.ios. After update the visual studio Mac and Xamarin studio . this problem was solved automatically.
why in Xamarin.ios
TEditorResponse response = await CrossTEditor.Current.ShowTEditor(transcription);
this editor is opened next tabbed page on TabbedviewController . which is content navigation ? any one have idea how to solve this ?
I was finally able to step through IOS after bringing into my project, as I was having same problem described above. The navigation was not correctly picking up the proper viewcontroller (the one thats the navigation). On my app I was able to add the following to resolve. This will likely need to be changed to work in every case, but I didn't have a way to test easily all scenarios (i.e. Tabbed navigation). Took me hours, so hope it helps the next person.
Replaced in IOS TEditorImplementation.cs
foreach (var vc in
UIApplication.SharedApplication.Windows[0].RootViewController.ChildViewControllers)
{
if (vc is UINavigationController)
nav = (UINavigationController)vc;
}
with
UINavigationController nav = GetTopMostController(UIApplication.SharedApplication.KeyWindow.RootViewController);
and added to the class BaseTEditor for IOS
private UINavigationController TopMostController;
private UINavigationController GetTopMostController(UIViewController inController)
{
TopMostController = null;
FindTopMostController(inController);
return TopMostController;
}
private void FindTopMostController(UIViewController inController)
{
if (inController != null)
{
if (inController is UINavigationController) // && inController.PresentedViewController != null)
{
TopMostController = inController as UINavigationController;
//return (inController as UINavigationController);
}
foreach (var child in inController.ChildViewControllers)
{
FindTopMostController(child);
}
}
}