Tabs in Non-rootviewcontroller Scenarios

Source: Internet
Author: User

New Empty Project

Add a Mainstoryboard

Set Startup item to Mainstoryboard

Overriding the window method of Appdelegate

public override UIWindow Window {      get;      Set;    }

Drag 3 View Controllers controls from the toolbox, and set the identity class to Viewcontroller1,viewcontroller2,viewcontroller3 respectively.

ViewController1 Add control lable, Button,button name is Abutton

ViewController2 add lable text to two,viewcontroller3 add lable text to three

The events for setting Abutton are as follows

Adding Methods in ViewController1.cs

partial void initialactioncompleted (UIButton sender)    {      Abutton.hidden = true;      }
public override void ViewDidLoad (){ if (ParentViewController != null){ aButton.Hidden = true; }}

Remove the extra two viewcontoller from the Toolbox by dragging a tab Bar Controller

Hold down CTRL, Abutton the tab bar controller, hold down CTRL and drag the mouse from the tab bar controller to the Viewcontroller1,viewcontroller2, ViewController3

The menu that appears during the drag process

Click Tab or modal

The final result is as follows

Tabs in Non-rootviewcontroller Scenarios

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.