그런 다음 그어떻게 중앙 제기 tabbar 항목을 만들 수 있습니까? 나는 아이폰 애플리케이션의 발전이 새로운 오전 말하고 싶은 처음에는
많은 감사처럼해야 내가 TabBar의의 항목을 선택 할 때 tabbaritem을 만들고 싶어 사전에.
그런 다음 그어떻게 중앙 제기 tabbar 항목을 만들 수 있습니까? 나는 아이폰 애플리케이션의 발전이 새로운 오전 말하고 싶은 처음에는
많은 감사처럼해야 내가 TabBar의의 항목을 선택 할 때 tabbaritem을 만들고 싶어 사전에.
이렇게하려면 하위 분류 UITabBarController
으로 사용자 정의 탭 막대를 만들어야합니다.
TabBarController.h 파일 :
- (void)viewDidLoad
{
[self loadTabView];
//[self viewWillAppear:YES];
[super viewDidLoad];
}
- (void) loadTabView
{
tabController = [[UITabBarController alloc] init];
tabController.delegate = self;
tabController.tabBar.backgroundColor = [UIColor clearColor];
//set offset for tabbar items images.
int topOffset = 6;
int bottomOffset = 6;
UIEdgeInsets imageInset = UIEdgeInsetsMake(topOffset, 0, -bottomOffset, 0);
[self.view addSubview:tabController.view];
}
// reset the background image in custom tabbar.
- (void) setTabBarBackground {
UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"btnbg.png"]];
img.frame = CGRectOffset(img.frame, 0, 1);
img.frame = CGRectMake(img.frame.origin.x, img.frame.origin.y-1, img.frame.size.width, img.frame.size.height);
[tabController.tabBar insertSubview:img atIndex:0];
[img release];
}
// reset the background image in custom tabbar.
- (void) resetTabBar : (NSString *) tabid
{
[img1 removeFromSuperview];
NSLog(@"tab id - %@",tabid);
switch ([tabid intValue]) {
case 0:
img1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tab-1.jpg"]];
break;
case 1:
img1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tab-2.jpg"]];
break;
case 2:
img1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tab-3.jpg"]];
break;
case 3:
img1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tab-4.jpg"]];
break;
case 4:
img1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tab-5.jpg"]];
break;
default:
break;
}
img1.frame = CGRectOffset(img1.frame, 0, 1);
[tabController.tabBar insertSubview:img1 atIndex:0];
[tabController.tabBar bringSubviewToFront:img1];
[img1 release];
}
// here push View controllers
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
}
가 당신에게 아이디어를 제공 희망
@interface TabBarController : UITabBarController<UITabBarControllerDelegate>
{
UITabBarController *tabController;
UIImageView *img1;
UIImageView *img2;
UIImageView *img3;
UIImageView *img4;
}
하는 .m 파일 ..
난이 문제를 해결했습니다 다른 way.What 당신의 도움을 주셔서 감사합니다 – Emon
@ 에몬 어떻게 해결 했습니까, 당신은 공유 할 수 있습니까? –
사용이 Article
이있는 정보는 꽤 많은 튜토리얼에 덮여있다. 이러한 앱의 대부분이 효과를 얻는 방법은 맞춤형 UIButton을 넣는 것입니다. 사용자 정의 UIButton은 탭 막대 상단에있는 유사한 탭과 비슷합니다.
iDev Recipes는 코드 예제 내가이 일을하지 권합니다
와 훌륭한 튜토리얼이 있습니다. iOS 사용자는 친숙한 탭 표시 줄 기능에 익숙합니다. 하이라이트는 그들이 어떤 탭인지를 알리기에 충분합니다.
디자인 아이디어는 매우 매력적이지만 비용은 많이 든다. 조정 막대 항목 옆의 막대 위에있는 영역이 낭비되거나 다른 아이콘의 크기를 줄여야합니다. 이렇게하면 사용하기가 더 어려워집니다.
다음은 유용한 팁입니다. 바쁜 생활에서 2 시간 정도 걸리고 iOS 용 Apple Human Interface Guidelines을 표지에서 표지까지 읽습니다. 매혹적인 독서와 같은 디자인 질문에 대한 좋은 지침을 줄 것입니다.
이 그것을 알고 이미 대답하지만, 다른 방법을 제공하고 싶었 됐어요 .
하위 클래스 UITabBarController는 문서에 따르면 좋지 않은 아이디어입니다. 또한 UIImagePickerController를 서브 클래 싱 된 tabbar 뒤에있는 뷰 컨트롤러 중 하나로 사용하려고했을 때 문제가 발생하지 않았습니다.
나는 탭 모음 항목 위에 uibutton을 오버레이하는 훨씬 간단한 방법을 사용했습니다. 예제 프로젝트는 여기에서 찾을 수 있습니다 :
https://github.com/group6/RaisedCenterButton
그것은하지만 그냥 예입니다. 앱에 앱을 통합하려면 작업을해야합니다.
uitabbar는 달성하려는 것을 지원하지 않습니다. 이 작업은 사용자 정의보기 집합을 사용하여 수행 할 수 있습니다. – Vlad
나에게 사용자 정의보기를 어떻게 보낼 수 있습니까? – Emon
이것을 확인하십시오 http://idevrecipes.com/2011/01/04/how-does-the-twitter-iphone-app-implement-a-custom-tab-bar/ – Vlad