We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Ability for each Tab to be linked to a separate ViewController

Thread ID:

Created:

Updated:

Platform:

Replies:

151215 Feb 4,2020 08:55 AM UTC Feb 12,2020 06:15 AM UTC Xamarin.iOS 5
loading
Tags: SfTabView
Bardi Golriz
Asked On February 4, 2020 08:55 AM UTC

Hi there,

I believe each TabItem expects a UIView in its Content prop. What I'm wondering is whether it's possible for each TabItem to be linked to a UIViewController instead (that host a UIView). The reason being each of my TabItems will have a separate ViewController. 

Looking forward to getting clarification.

🤞

Thanks!

Bardi

Hemalatha Marikumar [Syncfusion]
Replied On February 5, 2020 01:40 PM UTC

Hi Bardi Golriz, 
  
Greetings from the Syncfusion. 
  
We would like to let you know that we have checked the reported query and that it is not possible to link to the ViewController in the current implementation because the SfTabView is implemented in such a way that it accepts only the UIView. 
 
Please revert us for further investigation. 
 
Regards,
Hemalatha M. 


Bardi Golriz
Replied On February 6, 2020 12:58 PM UTC

Thanks for the response and clarification. That's a shame. Are there any plans to extend the control so that it supports multiple view controllers? At present, it does limit its capability. That said, would a workaround be to have a container view in each view and for that to link to its own view controller? I imagine that could work but would appreciate your confirmation on this (and whether it's recommended).


Sakthivel Palaniyappan [Syncfusion]
Replied On February 7, 2020 05:58 PM UTC

Hi Bardi,

Thanks for your update.

Since Content property of SfTabItem is of type UIView we could not set a Viewcontroller to it. However, the View Property of the ViewController is of the type UIView and hence can be set to the Content property of SfTabItem. We have provided a sample illustrating the same. Please do check if it satisfies your requirement.

Code snippet: 
  public override void ViewDidLoad() 
        { 
            base.ViewDidLoad(); 
            TabItem1Controller tabItem1Controller = new TabItem1Controller(); 
            TabItem2Controller tabItem2Controller = new TabItem2Controller(); 
            var tabView = new SfTabView(); 
            tabView.Frame = new CGRect(0, 0, View.Frame.Width, View.Frame.Height); 
            View.AddSubview(tabView); 
 
            var tabItems = new TabItemCollection 
            { 
                new SfTabItem() 
                { 
                    Title = "Calls", 
                    Content = tabItem1Controller.View 
                }, 
                new SfTabItem() 
                { 
                    Title = "Favorites", 
                    Content = tabItem2Controller.View 
                } 
            }; 
 
            tabView.Items = tabItems; 
        } 


Bardi Golriz
Replied On February 11, 2020 09:14 PM UTC

Smart! Thanks for the workaround :) I'll give it a try, and if I run into any issues with it, I'll let you know.

Divya Venkatesan [Syncfusion]
Replied On February 12, 2020 06:15 AM UTC

Hi Bardi, 
 
Thanks for the update, we wait to hear from you. 
 
Regards,    
Divya Venkatesan     


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon