Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

samirah

macrumors newbie
Original poster
Jan 31, 2011
3
0
Im trying to change the titel in my NSStatusBar from a different class, my preferences class..

In my ManagerClass.m & .h i have declared

Code:
- (NSStatusItem *)statusItem
{ return statusItem; }

I then import my ManagerClass.h in my preferences.m

then inside preferences.m i try to execute:

Code:
ManagerClass *someInstanceToIt = [[ManagerClass alloc] init];
[(NSStatusItem *)[someInstanceToIt statusItem] setTitle:@"New Title"];

But it seems that statusItem is never being passed to the preferences.m file, if i do a test with an if i can see that statusItem is empty..

Any ideas ? :)
 
Where is statusItem in ManagerClass being set?

Do you really want to alloc/init a new instance of ManagerClass inside a method of Preferences? Or are you rather wanting to reference an already existing instance of ManagerClass created elsewhere?

What are you type-casting the result of [someInstanceToIt statusItem]? This is unnecessary because statusItem is already declared to return type NSStatusItem *.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.