我有一个带标签栏的简单应用程序,根据用户输入禁用一个或多个条形项.我知道我需要使用我尝试使用的UITabBarDelegate.但是,当我调用委托方法时,我得到一个未捕获的异常错误[NSObject doesNotRecognizeSelector].我不确定我是在做这件事还是我没有错过任何东西.有什么建议.
我现在拥有以下内容:
WMViewController.h
#import <UIKit/UIKit.h>
#define kHundreds 0
@interface WMViewController : UIViewController <UITabBarDelegate, UIPickerViewDelegate, UIPickerViewDataSource>{
}
@end
WMViewController.m
#import "WMViewController.h"
#import "MLDTabBarControllerAppDelegate.h"
@implementation WMViewController
- (IBAction)finishWizard{
MLDTabBarControllerAppDelegate *appDelegate = (MLDTabBarControllerAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate setAvailabilityTabIndex:0 Enable:TRUE];
}
MLDTabBarControllerAppDelegate.h
#import <Foundation/Foundation.h>
@interface MLDTabBarControllerAppDelegate : NSObject <UITabBarDelegate>{
}
- (void) setAvailabilityTabIndex: (NSInteger) index Enable: (BOOL) enable;
@end
MLDTabBarControllerAppDelegate.m
#import "MLDTabBarControllerApplicationDelegate.h"
#import "MyListDietAppDelegate.h"
@implementation MLDTabBarControllerAppDelegate
- (void) setAvailabilityTabIndex: (NSInteger) index Enable: (BOOL) enable
{
UITabBarController *controller = (UITabBarController *)[[[MyOrganizerAppDelegate getTabBarController] viewControllers ] …Run Code Online (Sandbox Code Playgroud)