탭이있는 iOS 애플리케이션이 있습니다. 탭이 변경 될 때 어떤 탭이 활성 상태인지 감지해야합니다. 스토리 보드에는 탭보기 컨트롤러가 있는데, 탭을 잘 클릭하면보기가 바뀝니다. 나는 수업 TabBarController
을 생성하고 다음과 같이 정의된다 :iOS 탭 변경 여부 감지
헤더
@interface TabBarController : UITabBarController <UITabBarControllerDelegate>
@end
구현
#import "TabBarController.h"
@implementation TabBarController
// In the initialization section, set the delegate
- (id) init
{
self = [super init];
if (self)
{
self.delegate = self;
}
return self;
}
- (void)tabBarController:(UITabBarController *)tabBarController
didSelectViewController:(UIViewController *)viewController
{
NSLog(@"controller class: %@", NSStringFromClass([viewController class]));
NSLog(@"controller title: %@", viewController.title);
}
@end
그러나, 나는 위의 코드와 탭의 변화를 감지 할 수 없었다. 문제가 뭐라고 생각하니?
내 탭보기를 모든 콘센트에 연결하지 않았지만 다른보기로 연결합니다. 이게 문제 야? 그런 다음 콘센트를 어디에 연결해야합니까?
O_o에서 허용하는 이유는 무엇입니까? – Alfabravo