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

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
so in my SomeRandomClass i have a boolean called someRandomBool. i'm attempting to access the current value of said bool thru AnotherClass:

Code:
#import <UIKit/UIKit.h>
@class SomeRandomClass;

@interface AnotherClass : UIViewController
	{
	SomeRandomClass *someRandomClassInstance;
	}

@property (nonatomic, retain) IBOutlet SomeRandomClass *someRandomClassInstance;

@end

-=-=-=-

#import "AnotherClass.h"
#import "SomeRandomClass.h"


@implementation AnotherClass

@synthesize someRandomClassInstance;

- (void)loadView
	{
	if (someRandomClassInstance.someRandomBool == YES)
		NSLog(@"Bool Is YES");
		else
		NSLog(@"Bool Is NO");
	}
@end

... doesn't work.
 
because usually and what works is if you have
SomeClass *instanceOfClass
in the .h
then in the viewDidLoad you would have
instanceOfClass = [[SomeClass alloc] init];
then you can do
if ([instanceOfClass someBool])
// code if its set to true


And people are asking to try and understand what you have done instead

Also what errors are you getting?
are they build time errors or run time errors?
 
Is someRandomClassInstance set to the correct value when this line is executed?:
Code:
if (someRandomClassInstance.someRandomBool == YES)
 
i'm officially an idiot... officially... really, it's official.

the problem was that i hadn't set properties on the boolean variables, so the instance of the class couldn't access them...

thank you for all your help.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.