Tutorial details

Segment Control | App Code for Sale | Preview

Segment Control | iOS Tutorial

How to create and use segment controls

Overview PAGE TOP

Reference: http://www.geekylemon.com/WEBPROTECT-xcodesegmentcontroll.htm

In this tutorial i will be showing you how to create and use segment controls


  • 1 Label
  • 1 Segment Control

Using segment controls in your apps has great advantages as its basically a multifunction button and are mostly used in a settings page of an app allowing the using to select many options in the view of one button with segments controlling different features

ViewController.h PAGE TOP

@interface ViewController :UIViewController {
IBOutlet UILabel *label;
IBOutlet UISegmentedControl*segmentController;

ViewController.m PAGE TOP

@implementation ViewController
-(IBAction)segmentbutton:(id)sender {
if (segmentController.selectedSegmentIndex == 0) {
label.text = @"Button 1 Was Selected";
if (segmentController.selectedSegmentIndex == 1) {
label.text = @"Button 2 Was Selected";
if (segmentController.selectedSegmentIndex == 2) {
label.text = @"Button 3 Was Selected";
if (segmentController.selectedSegmentIndex == 3) {
label.text = @"Button 4 Was Selected";
if (segmentController.selectedSegmentIndex == 4) {
label.text = @"Button 5 Was Selected";

Reference PAGE TOP


0 Comments Leave a comment

Please login in order to leave a comment.

Newest first

to your Chupamobile Account.

The Easiest way to Launch your next App or Game.

Join Chupamobile and get instant access to thousands of ready made App and Game Templates.

Creating an account means you’re okay with Chupamobile’s Terms of Service and Privacy Policy.