2011-10-19 2 views
1

TabBarItem의 배지 값을 정확히 알지 못하면 어떻게 업데이트 할 수 있습니까? 사용자가 설정 한 내용에 따라 "기타"탭 또는 메인 탭바에있을 수 있습니다 ..업데이트보기 UITabBarItem badgeValue 추가보기

또한 tabbaritem이 "More"안에있는 경우 다른 항목 오른쪽에 badgeValue 만 추가 할 수 있습니까? SDK가 자동으로 생성하는 tableview에서 항목 자체에 배지를 추가하려면 어떻게해야합니까?

답변

1

예를 수행 할 수 있습니다, 당신은 알 필요가 없습니다 지수 :

@implementation SomeController 
... 
-(void)increaseBadgeValue{ 
    NSString *oldVal = self.tabBarItem.badgeValue; 
    self.tabBarItem.badgeValue = [NSString stringWithFormat:@"%d",[oldVal intValue]+1]; 
} 
.... 
@end 

또는 다른 컨트롤러를 수행하려는 경우, 그것을 '자기'대체 :

anotherController.tabBar.badgeValue .... 

앱에 navigationController가 있다면 :

anotherController.NavigationController.tabBarItem.badgeValue ...