//TabBarController code:
self.delegate=self;
self.tabBarController.tabBar.delegate=self;
CGRect viewFrame=self.tabBar.frame;
viewFrame.origin.y -=0;![enter image description here][1]
viewFrame.origin.x -=0;
viewFrame.size.height=30;
self.tabBar.frame=viewFrame;
firstViewController = [[FirstViewController alloc] initWithNibName:nil bundle:NULL];
secondViewController = [[SecondViewController alloc] initWithNibName:nil bundle:NULL];
NSArray *twoViewControllers = [[NSArray alloc] initWithObjects:
self.firstViewController, self.secondViewController, nil];
self.viewControllers=twoViewControllers;
// ====================================================
//
// FirstViewController code in initWithNibName:
//
// To set the title of the first tabbar item:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = @"Article view";
NSLog(@"count = %d",[self.tabBarController.tabBar.items count]);
}
return self;
}
//如何在不向tabbaritem添加任何//圖像的情況下將第一個tabbar項目標題「文章視圖」添加到中心?將iOS TabBar項目標題調整到它的中心
//類似於下面的tabbar物品截圖。
[1]: http://i.stack.imgur.com/xBpVH.png
Thanks in advance.
感謝您的問題,並感謝您的答案 – Abo3atef 2013-12-05 01:04:33