Hello,
Can you tell me how to make ios without storyboard?
Please create an iOS Application instead of iOS Tabbed Application, then there won't be a storyboard file in your project.
After that, you can create a TabController
as the rootcontroller of the Window.
AppDelegate
[Register ("AppDelegate")]
public class AppDelegate : UIApplicationDelegate {
public override UIWindow? Window {
get;
set;
}
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
Window = new UIWindow (UIScreen.MainScreen.Bounds);//new window
var vc = new TabController();
Window.RootViewController = vc;//root
Window.MakeKeyAndVisible ();
return true;
}
}
UITabBarController, about how to create UITabrController, you can see Tab Bars and Tab Bar Controllers in Xamarin.iOS - Xamarin | Microsoft Learn (this doc is about Xamarin, it applies to MAUI)
public class TabController : UITabBarController
{
UIViewController tab1, tab2, tab3;
public TabController()
{
tab1 = new UIViewController();// you can also create the subclass and add controls on that subclass
tab1.Title = "Green";
tab1.View.BackgroundColor = UIColor.Green;
tab2 = new UIViewController();
tab2.Title = "Orange";
tab2.View.BackgroundColor = UIColor.Orange;
tab3 = new UIViewController();
tab3.Title = "Red";
tab3.View.BackgroundColor = UIColor.Red;
var tabs = new UIViewController[] {
tab1, tab2, tab3
};
ViewControllers = tabs;
}
}
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.