मुझे पता है कि यह एक बहुत ही दोहराना विषय है, लेकिन मैं इसे काम नहीं कर सकता।TabBarController didSelectViewController काम नहीं कर रहा
MainTab.h:
#import <UIKit/UIKit.h>
@interface MainTab : UITabBarController<UITabBarControllerDelegate, UITabBarDelegate> {
IBOutlet UITabBarController *tabController;
}
@property (nonatomic,retain) IBOutlet UITabBarController *tabController;
@end
MainTab.m
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
NSLog(@"main tab");
[super viewDidLoad];
self.tabBarController.delegate = (id)self;
[self setDelegate:self];
// Do any additional setup after loading the view.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
-(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
NSLog(@"selected %d",tabBarController.selectedIndex);
}
मैं मैं क्या याद कर रहा हूँ नहीं मिल सकता है, किसी भी मदद की सराहना की जाएगी।
अब मैं MainStoryBoard में लिंक करने का प्रयास करें:
लेकिन यह does not काम, कनेक्शन क्या हैं?
कैसे करते हैं बनाया है 'MainTab' वस्तु ?? –
@Rob हां, आप सही हैं - मैंने किसी भी तरह से प्रश्न के "नियंत्रक" भाग को याद किया है, यह सोचकर कि यह एक टैब बार घटक के साथ एक कस्टम नियंत्रक है। मैंने अपनी टिप्पणी हटा दी, और आपके विस्तृत उत्तर के लिए मतदान किया। – dasblinkenlight