Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ui not showing in Xamarin.iOS #21

Open
rusty21 opened this issue Oct 31, 2017 · 10 comments
Open

Ui not showing in Xamarin.iOS #21

rusty21 opened this issue Oct 31, 2017 · 10 comments

Comments

@rusty21
Copy link

rusty21 commented Oct 31, 2017

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?

@Jhanbury
Copy link

Jhanbury commented Nov 9, 2017

@rusty21 its basically the same thing on Android I'm not sure if this is being maintained anymore

@jessejiang0214
Copy link
Contributor

I cannot reproduce this in Sample. Can you try this in Sample project?

@rusty21
Copy link
Author

rusty21 commented Nov 10, 2017

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.

@nmano2188
Copy link

Im also have same problem. did you fixed it?

@rr-rv
Copy link

rr-rv commented Apr 23, 2018

@rusty21 did you find a workaround for this problem?

@rusty21
Copy link
Author

rusty21 commented Apr 23, 2018

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.

@rr-rv
Copy link

rr-rv commented Apr 24, 2018

@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.

@Gopaldeysw
Copy link

Same Problem I was faced in Xamarin.ios. After update the visual studio Mac and Xamarin studio . this problem was solved automatically.

@Gopaldeysw
Copy link

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 ?

@tallmanBS
Copy link

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);
                }
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants