veereev
veereev

Reputation: 2688

How can I create a custom tabbar?

I am trying to create a tabbar in iOS. Firstly the tabbar will have 3 items. And the 3 items images width are different. The first 2 tabbar are 75 pixels each and the 3rd on is 170 pixels.( and each of them will have custom images )

enter image description here

Is it possible to achieve something like this?

Upvotes: 1

Views: 880

Answers (1)

Suresh
Suresh

Reputation: 1015

Put the image of background gray colour image to tabbar background image

tabBarCntrl.tabBar.backgroundImage = [UIImage imageNamed:@"graybackground.png"];

set the your desired frames to a,b,c imageviews.And set the red colour images to those imageviews.

aImageView=[[UIImageView alloc]initWithFrame:CGRectMake(15, 420, 50, 50)];

bImageView=[[UIImageView alloc]initWithFrame:CGRectMake(95, 420,50, 43)];

cImageView=[[UIImageView alloc]initWithFrame:CGRectMake(175, 420, 100, 50)];



aImageView.image=[UIImage imageNamed:@"a.png"];

bImageView.image=[UIImage imageNamed:@"b.png"];

cImageView.image=[UIImage imageNamed:@"c.png"];

subview the three images to tabbarcontroller

[tabBarCntrl.view addSubview:customersImageView];
[tabBarCntrl.view addSubview:invoicesImageView];
[tabBarCntrl.view addSubview:dashboardImageView];

[self.window addSubview:self.tabBarCntrl.view];

Upvotes: 1

Related Questions