我收到以下异常
setValue:forUndefinedKey:]:此类不是键值TableViewPrints的键值编码兼容。'
在这一行[self.view addSubview:MainVC.view];
我试图解决这个问题很长一段时间。从查看其他帖子和这样的错误,我得到了我与视图的定义冲突。我似乎已经分配了我想添加的视图。
这是我调用transitionWithView
的代码import "loginVC.h"
@interface loginVC ()
@end
@implementation loginVC
@synthesize clockNo, loginButton, activityIndicator, version, xmlData, MainVC;
- (void) switchToMainView
{
if (MainVC == nil)
{
UIViewController *MainView= [[UIViewController alloc] initWithNibName:@"LoadPrints" bundle:nil];
self.MainVC = MainView;
}
[UIView transitionWithView:self.view
duration:0.5
options:UIViewAnimationOptionTransitionFlipFromRight |
UIViewAnimationOptionLayoutSubviews |
UIViewAnimationOptionAllowAnimatedContent
animations:^
{
[self.view addSubview:MainVC.view];
}
completion:NULL];
}
这是我的头文件:
import <UIKit/UIKit.h>
import "ConsumeSoap.h"
import "ParserDelegate.h"
import "XMLNode.h"
import "LoadPrint"
@interface loginVC : UIViewController <ConsumeSoapDelegate> {
IBOutlet UITextField *clockNo;
IBOutlet UIButton *loginButton;
IBOutlet UIActivityIndicatorView *activityIndicator;
IBOutlet UILabel *version;
UIViewController *MainVC;
}
@property (nonatomic, strong) UITextField *clockNo;
@property (nonatomic, strong) UIButton *loginButton;
@property (nonatomic, strong) UIActivityIndicatorView *activityIndicator;
@property (nonatomic, strong) UILabel *version;
@property (nonatomic, strong) XMLNode *xmlData;
@property (nonatomic, strong) UIViewController *MainVC;
- (IBAction) backgroundClick: (id) sender;
- (IBAction) loginClick;
- (void) switchToMainView;
@end
提前感谢您的帮助。我花了一整天的时间试图解决这个问题。
这是我要打开的View的Header文件:
//LoadPrints.h
#import <UIKit/UIKit.h>
#import "ConsumeSoap.h"
#import "XMLNode.h"
#import "ParserDelegate.h"
@interface LoadPrints : UIViewController <ConsumeSoapDelegate,UITableViewDataSource,UITableViewDelegate>
{
IBOutlet UINavigationBar *printsButton;
IBOutlet UITableView *TableViewPrints;
IBOutlet UIActivityIndicatorView *activityIndicator;
NSMutableArray *listOfPrints;
BOOL refreshingPrints;
}
@property (nonatomic, strong) XMLNode *xmlData;
@property (nonatomic, strong) NSString * argPrintNumber;
@end