Moving a Tab Item
Send Feedback

Glossary Item Box

Topic Overview

Purpose

This topic provides an informational overview of moving a tab item on the IGSlideTabView™ control and demonstrates the usage using a code example.

In this topic


Introduction

Moving a tab summary

You can change which side the tab items display on the IGSlideTabView by setting the tabLocation property found on the IGSlideTabItem instance. The following enumerations are supported by the tabLocation property:

  • IGSlideTabLocationTop (default)
  • IGSlideTabLocationBottom
  • IGSlideTabLocationLeft
  • IGSlideTabLocationRight

When the tabLocation has been set the IGSlideTabView redraws the tab at the new location and calls a series of optional delegate methods along the way. The following is the order of optional delegate methods that are called when the tabLocation has been set.

  1. slideTabView:tabLocationWillChange:toLocation:
  2. slideTabView:tabContentSizeDidChange:
  3. slideTabView:tabLocationDidChange:fromLocation:

The slideTabView:tabLocationWillChange:toLocation: delegate method expects a return value of YES or NO to indicate whether or not to allow the location change.


Moving a Tab Item – Code Example

Description

The code example below creates and adds a tab item to the IGSlideTabView and then move the tab item from IGSlideTabLocationBottom to IGSlideTabLocationLeft after a 2 second delay.

Prerequisites

This code example requires the inclusion of the IG framework; details about how to add this framework are available in the Adding the IG Framework File topic.

Code

In Objective-C:

IGSlideTabView *slideTabView;
IGSlideTabItem *tabItem;
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    slideTabView = [[IGSlideTabView alloc] initWithFrame:self.view.bounds];
    slideTabView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
    [self.view addSubview:slideTabView];
    tabItem = [IGSlideTabItem tabWithLocation:IGSlideTabLocationBottom title:@"Example" tabView:nil contentView:nil];
    tabItem.contentSize = [IGSlideTabContentSize sizeWithPercentageWidth:0.3 percentageHeight:0.3];
    [slideTabView addTab:tabItem];
    [self performSelector:@selector(moveTab) withObject:nil afterDelay:2.0];
}
- (void)moveTab
{
    tabItem.tabLocation = IGSlideTabLocationLeft;
}

In C#:

IGSlideTabView slideTabView;
IGSlideTabItem tabItem;
public override void ViewDidLoad ()
{
      base.ViewDidLoad ();
      this.View.BackgroundColor = UIColor.White;
      slideTabView = new IGSlideTabView ();
      slideTabView.Frame = this.View.Bounds;
      slideTabView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
      this.View.Add (slideTabView);
      tabItem = new IGSlideTabItem ();
      tabItem.TabLocation = IGSlideTabLocation.IGSlideTabLocationBottom;
      tabItem.Title = "Example";
      tabItem.ContentSize = IGSlideTabContentSize.CreatePercentageSize (0.3f, 0.3f);
      slideTabView.AddTab(tabItem);
      this.PerformSelector (new MonoTouch.ObjCRuntime.Selector ("MoveTab"), null, 2.0f);
}
[Export("MoveTab")]
public void MoveTab()
{
      tabItem.TabLocation = IGSlideTabLocation.IGSlideTabLocationLeft;
}

Related Content

Topics

The following topic provides additional information related to this topic.

Topic

Purpose

The topics in this group cover enabling, configuring, and using the IGSlideTabView control’s supported features.