IPhone UI Button ,custom checkbox tutorials

IPhone UI Button ,custom checkbox tutorials
Checkbox is one of the elements that is frequently required in iPhone UIs, but the traditional checkbox is not present in iPhone sdk. Switches are sometimes used in the place of checkboxes.
In this tutorial, we will see how to create a custom checkbox. It extends from UIButton class. It is used to select or deselect a particular item or more than one items in a list. For example: The “Keep me signed in” checkbox in certain apps, sound on/off , effects on/off checkboxes in Settings of a gaming app.If more checkboxes are needed, we can create them similarly.
Step 1: Create a window based application in Xcode and name it “MICheckBox”.
Step 2: Create new “MICheckBox.h” and “MICheckBox.m” files which extend from UIView.
(Classes >> Add >> New File >> Objective C Class. Select UIView in the “subclass of” list.)
Step 3: Create a new group in the Classes folder and name it “MICheckBoxUtils”. Drag the “MICheckBox.h” and “MICheckBox.m” files into the group.Now, add the images “checkbox_not_ticked.png” and “checkbox_ticked.png” to the group.
Step 4: Open the “MICheckBox.h” file and make the following changes in it.

1@interface MICheckBox : UIButton {
2   BOOL isChecked;
3}
4@property (nonatomic,assign) BOOL isChecked;
5-(IBAction) checkBoxClicked;

Here, we have changed the UIView class from which it extends to UIButton. Also, we have declared a boolean property “isChecked” which
keeps a track of whether the button is checked or not. “checkBoxClicked” is the method to change the state of checkbox when it is clicked.
Step 5: Now, open the “MICheckBox.m” file and add the following code to it.
01#import "MICheckBox.h"
02
03@implementation MICheckBox
04@synthesize isChecked;
05
06- (id)initWithFrame:(CGRect)frame {
07     if (self = [super initWithFrame:frame]) {
08     // Initialization code
09
       self.contentHorizontalAlignment =
11     UIControlContentHorizontalAlignmentLeft;
12
13    [self setImage:[UIImage imageNamed:
14@"checkbox_not_ticked.png"]
15     forState:UIControlStateNormal];
16
17 [self addTarget:self action:
18@selector(checkBoxClicked)
19forControlEvents:UIControlEventTouchUpInside];
20}
21    return self;
22}
23
24-(IBAction) checkBoxClicked{
25      if(self.isChecked ==NO){
26            self.isChecked =YES;
27              [self setImage:[UIImage imageNamed:
28 @"checkbox_ticked.png"]
29 forState:UIControlStateNormal];
30
1  }else{
32 self.isChecked =NO;
33 [self setImage:[UIImage imageNamed:
34@"checkbox_not_ticked.png"]
35forState:UIControlStateNormal];
36
37 }
38}
39
40- (void)dealloc {
41 [super dealloc];
42}
43
44@end

initWithFrame” method – This method initializes the button with the frame given by us. The contentHorizontalAlignment property allows us to set the alignment of the content (i.e image and text) of the button(checkbox). Initially, the image of the button will be the unselected checkbox, so we set the image “checkbox_not_ticked.png”. Then we programmatically link the button to the “checkBoxClicked” method.
“checkBoxClicked” method – In this method, whenever the checkbox is clicked, the image is changed from checked to unchecked and vice versa.
Step 6: Now that we have created the “MICheckBox” files, we need to test them. Hence, put the following code in the “MICheckBoxAppDelegate.m” file.
01#import "MICheckBoxAppDelegate.h"
02#import "MICheckBox.h"
03
04@implementation MICheckBoxAppDelegate
05@synthesize window;
06
07- (void)applicationDidFinishLaunching:(UIApplication *)application {
08
09       // Override point for customization after application launch
10       MICheckBox *checkBox =[[MICheckBox alloc]
11       initWithFrame:CGRectMake(100, 200, 150, 25)];
12
13       [checkBox setTitleColor:[UIColor blackColor]
14       forState:UIControlStateNormal];
15
16       [checkBox setTitle:@"Checkbox"
17        forState:UIControlStateNormal];
18
19       [window addSubview:checkBox];
20      [window makeKeyAndVisible];
21}
22
23- (void)dealloc {
24                 [window release];
25                 [super dealloc];
26}
27
28@end

Here, we have imported the “MICheckBox.h” file so that we can create its instance. In the “applicationDidFinishLaunching” method, we create an object of MICheckbox and set its title color to black. Also, we set its title to CheckBox. Then we add the checkbox to the main window by the “addSubview” method.

YOU CAN DOWLOAD THE TUTORIAL HERE ON CINTERVIEWS.COM

Output is like This:

  

IPhone Tutorial:UISegmentedControl Tutorial

IPhone Tutorial:UISegmentedControl Tutorial
A segmented control shows a horizontal list of items. Each segment looks like a button. The segments remains “pressed” even after the user lifts his finger.When a different segment is tapped, its corresponding value can be obtained.
Segmented control comes in handy when you want to show/hide different data without changing the current view.For e.g you can have a set of images and you display only one when a segment is selected. When you select a different segment, depending on that, the picture changes.
So lets get started.:
Step 1:Start Xcode and create a view based application with name “SegmentedControlDemo”.
Step 2:Open the “SegmentedControlDemoViewController.h” file and put the following code in it.

01#import
02@interface SegmentedControlDemoViewController : UIViewController {
03UILabel *segmentLabel;
04UISegmentedControl *segmentedControl;
05}
06 
07@property (nonatomic,retain) IBOutlet UILabel *segmentLabel;
08@property (nonatomic,retain) IBOutlet UISegmentedControl *segmentedControl;
09 
10-(IBAction) segmentedControlIndexChanged;
11 end them

 Here, we have declared a label and segmented control and set properties and outlets for both of them.
Step 3:Open the “SegmentedControlDemoViewController.m” file. Synthesize both the properties and release them.Also provide the implementation for segmentedControlIndexChanged method.

01#import "SegmentedControlDemoViewController.h"
02 
03@implementation SegmentedControlDemoViewController
04@synthesize segmentLabel;
05@synthesize segmentedControl;
06 
07// Implement viewDidLoad to do additional setup after loading the view.
08- (void)viewDidLoad {
09  self.segmentLabel.text =@"Segment 1 selected.";
10  [super viewDidLoad];
11}
12 
13- (void)dealloc {
14  [segmentLabel release];
15  [segmentedControl release];
16  [super dealloc];
17}
18 
19-(IBAction) segmentedControlIndexChanged{
20  switch (self.segmentedControl.selectedSegmentIndex) {
21    case 0:
22      self.segmentLabel.text =@"Segment 1 selected.";
23      break;
24    case 1:
25      self.segmentLabel.text =@"Segment 2 selected.";
26      break;
27 
28    default:
29       break;
30   }
31 
32}
33 @end
In the segmentedControlIndexChanged method, we have used a switch case which switches the selected segment index of the segmented control. For each case, we have set the text of the label to the respective segment selected.
Step 4: Save(command+s) the project.Now open the “SegmentedControlDemoViewController.xib” file from the Resources folder. Drag and drop a label and a segmented control from the library on the view as shown below. Stretch the edges of the label so that it becomes long enough to display “Segment x selected.”


Note: If you want more than two segments in the segmented control, go to Attributes Inspector for segmented control and change the value for Segments field.
Step 5:Select the File’s Owner in the xib window and open its Connections Inspector(command+2) and make the following connections.
Connect segmentControl to segmented control and segmentLabel to label. The Connections Inspector for File’s Owner will then look like this:



Step 6: Open the Connections Inspector for segmented control and link the value changed argument to the segmentedControlIndexChanged method in the File’s Owner.



Step 7: Build and run the project. You will see that when you tap different segments of the segmented control, the text of the label changes.

You can download the source code on cinterviews.com here



Done with UISegmentControl on cinterviews.com tutorials

 

Differentiate RAID & JBOD?

 Differentiate RAID & JBOD?
RAID: “Redundant Array of Inexpensive Disks”
Fault-tolerant grouping of disks that server sees as a single disk volume
Combination of parity-checking, mirroring, striping
Self-contained, manageable unit of storage

JBOD: “Just a Bunch of Disks”
Drives independently attached to the I/O channel
Scalable, but requires server to manage multiple volumes
Do not provide protection in case of drive failure

When JBODs are Used

When JBODs are Used
“Just a Bunch of Disks”
It is a collection of disks that share a common connection to the server, but don’t include the mirroring,
striping, or parity facilities that RAID systems do, but these capabilities are available with host-based software.

What is the difference between RAID 0+1 and RAID 1+0

What is the difference between RAID 0+1 and RAID 1+0
RAID 0+1 (Mirrored Stripped)
In this RAID level all the data is saved on stripped volumes which are in turn mirrored, so any disk failure saves the data loss but it makes whole stripe unavailable. The key difference from RAID 1+0 is that RAID 0+1 creates a second striped set to mirror a primary striped set. The array continues to operate with one or more drives failed in the same mirror set, but if drives fail on both sides of the mirror the data on the RAID system is lost. In this RAID level if one disk is failed full mirror is marked as inactive and data is saved only one stripped volume.
RAID 1+0 (Stripped Mirrored)
In this RAID level all the data is saved on mirrored volumes which are in turn stripped, so any disk failure saves data loss. The key difference from RAID 0+1 is that RAID 1+0 creates a striped set from a series of mirrored drives. In a failed disk situation RAID 1+0 performs better because all the remaining disks continue to be used. The array can sustain multiple drive losses so long as no mirror loses both its drives.
This RAID level is most preferred for high performance and high data protection because rebuilding of RAID 1+0 is less time consuming in comparison to RAID 0+1.

Define RAID? Which one you feel is good choice?

Define RAID? Which one you feel is good choice?
RAID (Redundant array of Independent Disks) is a technology to achieve redundancy with faster I/O. There are Many Levels of RAID to meet different needs of the customer which are: R0, R1, R3, R4, R5, R10, R6.
Generally customer chooses R5 to achieve better redundancy and speed and it is cost effective.


R0 – Striped set without parity/[Non-Redundant Array].
Provides improved performance and additional storage but no fault tolerance. Any disk failure destroys the array, which becomes more likely with more disks in the array. A single disk failure destroys the entire array because when data is written to a RAID 0 drive, the data is broken into fragments. The number of fragments is dictated by the number of disks in the drive. The fragments are written to their respective disks simultaneously on the same sector. This allows smaller sections of the entire chunk of data to be read off the drive in parallel, giving this type of arrangement huge bandwidth. RAID 0 does not implement error checking so any error is unrecoverable. More disks in the array means higher bandwidth, but greater risk of data loss
R1 - Mirrored set without parity.
Provides fault tolerance from disk errors and failure of all but one of the drives. Increased read performance occurs when using a multi-threaded operating system that supports split seeks, very small performance reduction when writing. Array continues to operate so long as at least one drive is functioning. Using RAID 1 with a separate controller for each disk is sometimes called duplexing.
R3 - Striped set with dedicated parity/Bit interleaved parity.
This mechanism provides an improved performance and fault tolerance similar to RAID 5, but with a dedicated parity disk rather than rotated parity stripes. The single parity disk is a bottle-neck for writing since every write requires updating the parity data. One minor benefit is the dedicated parity disk allows the parity drive to fail and operation will continue without parity or performance penalty.
R4 - Block level parity.
Identical to RAID 3, but does block-level striping instead of byte-level striping. In this setup, files can be distributed between multiple disks. Each disk operates independently which allows I/O requests to be performed in parallel, though data transfer speeds can suffer due to the type of parity. The error detection is achieved through dedicated parity and is stored in a separate, single disk unit.
R5 - Striped set with distributed parity.
Distributed parity requires all drives but one to be present to operate; drive failure requires replacement, but the array is not destroyed by a single drive failure. Upon drive failure, any subsequent reads can be calculated from the distributed parity such that the drive failure is masked from the end user. The array will have data loss in the event of a second drive failure and is vulnerable until the data that was on the failed drive is rebuilt onto a replacement drive.
R6 - Striped set with dual distributed Parity.
Provides fault tolerance from two drive failures; array continues to operate with up to two failed drives. This makes larger RAID groups more practical, especially for high availability systems. This becomes increasingly important because large-capacity drives lengthen the time needed to recover from the failure of a single drive. Single parity RAID levels are vulnerable to data loss until the failed drive is rebuilt: the larger the drive, the longer the rebuild will take. Dual parity gives time to rebuild the array without the data being at risk if one drive, but no more, fails before the rebuild is complete.
 

What are the advantages of RAID?

What are the advantages of RAID? 
“Redundant Array of Inexpensive Disks”
Depending on how we configure the array, we can have the
- data mirrored [RAID 0] (duplicate copies on separate drives)
- striped [RAID 1] (interleaved across several drives), or
- parity protected [RAID 5](extra data written to identify errors).
These can be used in combination to deliver the balance of performance and reliability that the user requires.

What’s the need for separate network for storage why LAN cannot be used?

What’s the need for separate network for storage why LAN cannot be used?
LAN hardware and operating systems are geared to user traffic, and LANs are tuned for a fast user response to messaging requests.
With a SAN, the storage units can be secured separately from the servers and totally apart from the user network enhancing storage access in data blocks (bulk data transfers), advantageous for server-less backups.

Name some of the SAN topologies

Name some of the SAN topologies
Point-to-point, arbitrated loop, and switched fabric topologies

WHEN SHOULD I DEPLOY FIBRE CHANNEL INSTEAD OF ISCSI?

WHEN SHOULD I DEPLOY FIBRE CHANNEL INSTEAD OF ISCSI?
For environments consisting of high-end servers that require high bandwidth or data center environments with business-critical data, Fibre Channel is a better fit than iSCSI. For environments consisting of many midrange or low-end servers, an IP SAN solution often delivers the most appropriate price/performance.

HOW IS FIBRE CHANNEL DIFFERENT FROM ISCSI?

HOW IS FIBRE CHANNEL DIFFERENT FROM ISCSI?
Fibre Channel and iSCSI each have a distinct place in the IT infrastructure as SAN alternatives to DAS. Fibre Channel generally provides high performance and high availability for business-critical applications, usually in the corporate data center. In contrast, iSCSI is generally used to provide SANs for business applications in smaller regional or departmental data centers.

WHAT ARE THE BENEFITS OF 4GB FIBRE CHANNEL?

WHAT ARE THE BENEFITS OF 4GB FIBRE CHANNEL?
Benefits include twice the performance with little or no price increase, investment protection with backward compatibility to 2 GB, higher reliability due to fewer SAN components (switch and HBA ports) required, and the ability to replicate, back up, and restore data more quickly. 4 GB Fibre Channel systems are ideally suited for applications that need to quickly transfer large amounts of data such as remote replication across a SAN, streaming video on demand, modeling and rendering, and large databases. 4 GB technology is shipping today.

WHAT IS THE FUTURE OF FIBRE CHANNEL SANS?

WHAT IS THE FUTURE OF FIBRE CHANNEL SANS?
Fibre Channel is a well-established, widely deployed technology with a proven track record and a very large installed base, particularly in high-performance, business-critical data center environments. Fibre Channel SANs continue to grow and will be enhanced for a long time to come. The reduced costs of Fibre Channel components, the availability of SAN kits, and the next generation of Fibre Channel (4 GB) are helping to fuel that growth. In addition, the Fibre Channel roadmap includes plans to double performance every three years

HOW LONG HAS FIBRE CHANNEL BEEN AROUND?

HOW LONG HAS FIBRE CHANNEL BEEN AROUND?
Development started in 1988, ANSI standard approval occurred in 1994, and large deployments began in 1998. Fibre Channel is a mature, safe, and widely deployed solution for high-speed (1 GB, 2 GB, 4 GB) communications and is the foundation for the majority of SAN installations throughout the world.

WHAT CUSTOMER PROBLEMS DO FIBRE CHANNEL SANS SOLVE?

WHAT CUSTOMER PROBLEMS DO FIBRE CHANNEL SANS SOLVE?
The increased performance of Fibre Channel enables a highly effective backup and recovery approach, including LAN-free and server-free backup models. The result is a faster, more scalable, and more reliable backup and recovery solution. By providing flexible connectivity options and resource sharing, Fibre Channel SANs also greatly reduce the number of physical devices and disparate systems that must be purchased and managed, which can dramatically lower capital expenditures. Heterogeneous SAN management provides a single point of control for all devices on the SAN, lowering costs and freeing personnel to do other tasks.

WHICH ENVIRONMENT IS MOST SUITABLE FOR FIBRE CHANNEL SANS

 WHICH  ENVIRONMENT IS MOST SUITABLE FOR FIBRE CHANNEL SANS
Typically, Fibre Channel SANs are most suitable for large data centers running business-critical data, as well as applications that require high-bandwidth performance such as medical imaging, streaming media, and large databases. Fibre Channel SAN solutions can easily scale to meet the most demanding performance and availability requirements.

WHAT ARE THE BENEFITS OF FIBRE CHANNEL SANS?

WHAT ARE THE BENEFITS OF FIBRE CHANNEL SANS?
Fibre Channel SANs are the de facto standard for storage networking in the corporate data center because they provide exceptional reliability, scalability, consolidation, and performance. Fibre Channel SANs provide significant advantages over direct-attached storage through improved storage utilization, higher data availability, reduced management costs, and highly scalable capacity and performance.

IPhone Tutorials UI Slider Control Tutorial

IPhone Tutorials UI Slider Control Tutorial
Slider is a horizontal bar with a slider button which can slide along the bar’s length. The value of the slider changes according to the position of the slider button and this value can be displayed on a label beside the slider. This is precisely what we are going to do in this tutorial.
Slider can be used as a value setter for a particular object such as a volume control.

Step 1: Start Xcode and create a view based application with name “SliderDemo”.
Step 2: Open “SliderDemoViewController.h” and put the following code in it.

01@interface SliderDemoViewController : UIViewController {
02      UILabel *sliderLabel;
03
04}
05
06@property (nonatomic,retain) IBOutlet UILabel *sliderLabel;
07
08-(IBAction) sliderChanged:(id) sender;
09

@end


 

 Put the following code in the “SliderDemoViewController.m” file.

01@implementation SliderDemoViewController
02@synthesize sliderLabel;
03 
04- (void)dealloc {
05  [sliderLabel release];
06      [super dealloc];
07}
08 
09-(IBAction) sliderChanged:(id) sender{
10  UISlider *slider = (UISlider *) sender;
11  int progressAsInt =(int)(slider.value + 0.5f);
12  NSString *newText =[[NSString alloc]
13                  initWithFormat:@"%d",progressAsInt];
14  self.sliderLabel.text = newText;
15  [newText release];
16}
17 
18@end

Here, in the sliderChanged method, we have declared an object of type slider. The variable progressAsInt has been used to store the slider’s position.0.5f is added to the slider value to round it off. We then put the value of progressAsInt in a string and set it as the label’s text.
Step 3: Save(command+s) the project. Now open the “SliderDemoViewController.xib” file from the Resources folder. Add a slider and a label beside it to the view as shown below.
 Open the Attributes Inspector for slider.Set the fields under Values as Minimum = 1,Maximum = 100 and Initial = 50.
Step 4: Open the Connections Inspector(command+2) for slider. Connect the value changed link to the sliderChanged method in File’s Owner. Also connect the label to sliderLabel in the File’s Owner.
Step 5: Save,build and run the project. Now as you slide the slider button, the value displayed by the label changes.
You can download the source code in cinterviews here

OUTPUT :.



Iphone Tutorials UI Switch Control



Iphone Tutorials UI Switch Control 
Switch in an iphone application is very similar to its electronic counterpart in its working. By default it is set to OFF. You can change its value manually or programmatically (as you prefer). When the switch is pressed, it toggles with animation and changes its state from ON to OFF or OFF to ON. For eg. It can be used to mute or unmute volume.
In this tutorial, we will change the value of the switch manually and programmatically. So lets get started.
Step 1: Start Xcode and create a view based application with name “SegmentedControlDemo”.
Step 2: Put the following code in “SwitchDemoViewController.h” file.

01@interface SwitchDemoViewController : UIViewController {
02    UILabel *switchLabel;
03    UISwitch *toggleSwitch;
04}
05
06@property (nonatomic,retain) IBOutlet UILabel *switchLabel;
07@property (nonatomic,retain) IBOutlet UISwitch *toggleSwitch;
08
09-(IBAction) switchValueChanged;
10-(IBAction) toggleButtonPressed;
11 @end
Put the following code in “SwitchDemoViewController.m” file.
01@implementation SwitchDemoViewController
02@synthesize switchLabel;
03@synthesize toggleSwitch;
04
05- (void)dealloc {
06  [switchLabel release];
07  [toggleSwitch release];
08  [super dealloc];
09}
10
11-(IBAction) switchValueChanged{
12  if (toggleSwitch.on) { switchLabel.text = @"Enabled"; }
13  else { switchLabel.text = @"Disabled";}
14}
15
16-(IBAction) toggleButtonPressed{
17  if(toggleSwitch.on){
18    [toggleSwitch setOn:NO animated:YES];
19  }
20  else{
21    [toggleSwitch setOn:YES animated:YES];
22
23  }
24
25}
26 @end
SwitchValueChanged method:
In this method, we have monitored the value of the switch. If it is on, we set the text of the label to “Enabled” and if it is off, we set it to “Disabled”.

toggleButtonPressed method:
Here, if the switch value is on, we set it to off using the setOn: animated: method. And vice versa.
Step 3: Save(command+s) the project. Open the “SwitchDemoViewController.xib” file from Resources folder. Add a label,switch and a button to the view.Name the button “toggle”.
       
 
Step 4: Now go to Connections Inspector(command+2) for File’s Owner. Connect switchLabel to label, toggleSwitch to switch, switchValueChanged method to “Value changed” event of the switch and toggleButtonPressed method to “Touch Up Inside” event of the button in the view.
Step 5: Save,build and run the project. When you toggle the switch, the text of the label will change and when you press the toggle button, the state of the switch will change.

You can download the source code here from cinterviews.com 

OUTPUT :
                                                                                                                        




Iphone Tutorials UITabBarController Iphone tab bar

Iphone Tutorials UITabBarController Iphone tab bar
A Tab Bar Controller helps to organize an application along functional lines.It is used to switch between multiple pages in an application. Each tab of a tab bar controller interface is associated with a view controller.Whenever a tab is tapped by a user,the tab bar controller object selects the particular tab and displays the corresponding view associated with the tab.This blog will assist you on how to create applications using tab bar controller.
Step 1 : Start Xcode and create a new project by selecting Window- Based Application.
Step 2 : Open “PrjTabBarControllerAppDelegate.h” and put following code in it.

01#import
02 
03@interface PrjTabBarControllerAppDelegate:NSObject
04 {
05 
06     UIWindow *window;
07     UITabBarController *tcTabBar;
08}
09 
10@property (nonatomic, retain) IBOutlet UIWindow *window;
11@property (nonatomic, retain) IBOutlet *tcTabBar;
12@end

Here ‘”tcTabBar” is an instance variable of type UITabBarController. We have created an outlet, so that we can relate our instance ‘tcTabBar’ with TabBarController.
Step 3 : Open “PrjTabBarControllerAppDelegate.m” and put following code in it. In the ‘applicationDidFinishLaunching’ method we have added the Tab Bar Controller as a sub view to the existing window. Save the project using (command + S).
01#import "PrjTabBarControllerAppDelegate.h"
02 
03@implementation PrjTabBarControllerAppDelegate
04 
05@synthesize window;
06@synthesize tcTabBar;
07 
08- (void)applicationDidFinishLaunching:(UIApplication *)application {
09 
10  // Override point for customization after application launch
11  [window addSubview:tcTabBar.view];
12  [window makeKeyAndVisible];
13}
14 
15- (void)dealloc {
16  [tcTabBar release];
17  [window release];
18    [super dealloc];
19}
20 
21@end
Step 4 : Open the Interface Builder by double clicking on MainWindow.xib file. Drag & Drop a Tab Bar Controller from the Library(shift + command + L.). Make sure that the Tab Bar Controller is dropped on the MainWindow.xib since it is not allowed to be placed on the View Controller.We will see a Tab Controller with two bar items created for us. Add one more tab item to it from the library.



As we can see a Tab Bar Item has ‘Title’ & ‘Image’ associated with it. Double Click on Item 1. Open the ‘Attributes Inspector’ (command + 1).In the ‘Atrributes Inspector’ we can set the title & image for Tab Bar Item. The image that we are adding should be present in the Project folder.To add an image to Project right click on ‘Resources’ -> Add -> Existing Files and select the image.



Step 5 : Now connect the Tab Bar Controller to PrjTabBarControllerAppDelegate. Open the ‘Connection Inspector’ (command + 2). Connect “tcTabBar” in the File’s Owner to Tab Bar Controller.

Step 6 : Right click on ‘Classes’ in Group & Files Explorer & add UIViewController subclass file. Select the option ‘With XIB for user interface’. The files added should be equal to number of Tab Bar items present.Here, we add three UIViewController so name them as View1ViewController, View2ViewController, View3ViewController.
Step 7 : Open the View2ViewController.xib by double clicking on it. Set the color of the view from the ‘Attribute Inspector’.Save & Close the .xib file. Similarly set the colours for other views.



Step 8 : Now we need to specify which views should be there in each tab of TabBarController. For this open ‘Interface Builder’. Open ‘Identity Inspector’ (command + 4). Set the class of each Tab Bar Item to its respective view.


Step 9 : Save,Build & Run the project.When we switch the tabs you will observe the views .
You can download the source code here from cinterviews.

OUTPUT