Hi,

I am looking for a little help on my iphone project. I am beginner and am having trouble with the UISwitch control. I wasn't sure if I should post to this list as it isn't specifically for Cocoa Touch, so if I am posting in the wrong place, please accept my apologies.

I have a tab bar application which simply consists of 3 views. I am having a problem with a UISwitch on one of my views. My view controller code is declared as follows:

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

@interface SocialViewController : UIViewController {
    IBOutlet UISearchDisplayController *searchDisplayController;
    IBOutlet UIView *view;
    IBOutlet UISwitch *mySwitch;
}

-(IBAction) switchValueChanged:(id)sender;

@end


#import "SocialViewController.h"

@implementation SocialViewController


-(IBAction) switchValueChanged:(id) sender {
        NSLog(@"Hello");
}

- (void)didReceiveMemoryWarning {
        // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
        
        // Release any cached data, images, etc that aren't in use.
}
-(void) viewDidLoad {
}

- (void)viewDidUnload {
        // Release any retained subviews of the main view.
        // e.g. self.myOutlet = nil;
}


- (void)dealloc {
        [super dealloc];
}

@end

I set the Files Owner in IB to SocialViewController and wire up all of the outlets. However when I run the program, all runs fine until I attempt to switch to the view in question, I get the error:

'NSUnknownKeyException', reason: '[<UIViewController 0x3c0ae30> setValue:forUndefinedKey:]: this class is not key value coding- compliant for the key mySwitch.'
2009-10-27 11:38:53.426 LocationPoster[664:207] Stack: (
    29291611,
    2518990665,
    29450689,
    223864,
    222405,
    4560072,
    29194543,
    4554623,
    4562891,
    3248479,
    3242043,
    3241761,
    3292146,
    3287261,
    3294786,
    3294128,
    2720857,
    4583563,
    2720857,
    3128226,
    3136963,
    3128153,
    2720857,
    3128226,
    3136963,
    3132175,
    2825779,
    2734108,
    2760885,
    37387985,
    29076352,
    29072456,
    37382029,
    37382226,
    2764803,
    9488,
    9342
)


The strange thing is, if I create a simple view based application and use the same code there, it works perfectly fine.

Does anyone know where I am going wrong?
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to