Quote:
Originally Posted by Conor.Higgins
Mikelsoft, I fixed this to an extent by using my app delegate to create a new instance of the viewcontroller I was trying to access and then calling the function I needed to access. This works fine for updating data and other things like that. What sort of method are you trying to call?
Conor
|
Hi Conor,
I want to update a tabbaritem.badgevalue of the tabbarcontroller with a method in the appdelegate. The error says: "instance variable 'tabBarItem1' accessed in class method"and "instance variable 'tabBarItem2' accessed in class method"
Appdelegate.h
@interface AppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
UIWindow *window;
UITabBarController *tabBarController;
UITabBarItem *tabBarItem1;
UITabBarItem *tabBarItem2;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
@property (nonatomic, retain) IBOutlet UITabBarItem *tabBarItem1;
@property (nonatomic, retain) IBOutlet UITabBarItem *tabBarItem2;
+ (void) updateBadgeValue;
Appdelegate.m
@synthesize tabBarController, tabBarItem1, tabBarItem2;
+ (void) updateBadgeValue
{
tabBarItem1.badgeValue = "Test1";
tabBarItem2.badgeValue = "Test2";
}
I try to call this from one of the two viewcontrollers by using:
[AppDelegate updateBadgeValue];
It looks like there is a problem with the +(void) !!??
Thanks for your help, Mikel