I'm building an app but having a problem when i try and open a second view.
The code:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSInteger FontSizeValue = [[NSUserDefaults standardUserDefaults] integerForKey:@"FontSize"];
UIFont *pagedefault = [UIFont fontWithName:@"Arial" size:FontSizeValue];
Page1Text.font = pagedefault;
Page2Text.font = pagedefault;
}
Output:
2012-03-16 11:16:11.573 Accessibility Guide[3418:f803] *** Terminating app due to
uncaught exception 'NSUnknownKeyException', reason: '[<TextViewController 0x687e4d0>
setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key
Page2.'
*** First throw call stack:
(0x13cd022 0x155ecd6 0x13ccee1 0x9c5022 0x936f6b 0x936edb 0x951d50 0x23971a 0x13cedea
0x13387f1 0x23826e 0xde1fc 0xde779 0xde99b 0xded11 0xf08fd 0xf0aef 0xf0dbb 0xf185f
0xf1e06 0xf1a24 0x44dde6 0x4424d0 0xa8581 0xa87fa 0x93d85d 0x13a1936 0x13a13d7 0x1304790
0x1303d84 0x1303c9b 0x12b67d8 0x12b688a 0x17626 0x233d 0x22a5)
terminate called throwing an exception(lldb)
Feel free to request any more information. I'm still fairly new to objective-c so I'll do my best.
NOTE: I am using one view controller file (TextViewController.h TextViewController.m) for two views (i only have two views so far but there will be more) because all the views look the same but they all share the same code. Each view has a "Next Button" and a "Text Box"
TextViewController.h
#import <UIKit/UIKit.h>
@interface TextViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextView *Page1Text;
@property (weak, nonatomic) IBOutlet UITextView *Page2Text;
@end
TextViewController.m
#import "TextViewController.h"
@interface TextViewController ()
@end
@implementation TextViewController
@synthesize Page1Text;
@synthesize Page2Text;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSInteger FontSizeValue = [[NSUserDefaults standardUserDefaults] integerForKey:@"FontSize"];
UIFont *pagedefault = [UIFont fontWithName:@"Arial" size:FontSizeValue];
Page1Text.font = pagedefault;
Page2Text.font = pagedefault;
}
- (void)viewDidUnload
{
[self setPage1Text:nil];
[self setPage2Text:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}