[英]xcode error: No visible @interface for masterViewController declares the selector
I am having what seems to be a fairly common problem but I cannot figure out what is wrong with my code specifically. 我有一个似乎是一个相当常见的问题,但我无法弄明白我的代码有什么问题。
I have scoured stackoverflow and read at least a dozen posts that are similar to mine, but I cannot figure out my personal problem. 我已经搜索了stackoverflow并阅读了至少十几个与我相似的帖子,但我无法弄清楚我的个人问题。
Basically, I am trying to pass the NSMutableDictionary from the modal view to the master view. 基本上,我试图将NSMutableDictionary从模态视图传递到主视图。 Here's the code:
这是代码:
QuoteMasterViewController.h: QuoteMasterViewController.h:
@class QuoteModalViewController;
@interface QuoteMasterViewController : UITableViewController
@end
QuoteMasterViewController.m: QuoteMasterViewController.m:
#import "QuoteMasterViewController.h"
#import "QuoteModalViewController.h"
#import "QuoteDetailViewController.h"
@interface QuoteMasterViewController () {
NSMutableArray *_objects;
}
@end
@implementation QuoteMasterViewController
//after the ViewDidLoad method...
-(void)addQuotationWithDictionary: (NSMutableDictionary *)myDictionary {
[self insertNewObject:myDictionary];
[self dismissModalViewControllerAnimated:YES];
}
QuoteModalViewController.h: QuoteModalViewController.h:
#import <UIKit/UIKit.h>
@class QuoteMasterViewController;
@interface QuoteModalViewController : UIViewController <UITextFieldDelegate>
@property (nonatomic, weak) QuoteMasterViewController *masterView;
@property (strong, nonatomic) IBOutlet UITextField *sourceQuoted;
@property (strong, nonatomic) IBOutlet UITextField *quoteQuoted;
- (IBAction)saveButtonPressed:(id)sender;
- (IBAction)cancelButtonPressed:(id)sender;
@end
QuoteModalViewController.m: QuoteModalViewController.m:
#import "QuoteModalViewController.h"
#import "QuoteMasterViewController.h"
@interface QuoteModalViewController ()
@end
@implementation QuoteModalViewController
@synthesize sourceQuoted;
@synthesize quoteQuoted;
@synthesize masterView;
//After ViewDidLoad
- (IBAction)saveButtonPressed:(id)sender {
if (![sourceQuoted.text isEqualToString:@""] && ![quoteQuoted.text isEqualToString:@""]) {
NSString *sourceString = sourceQuoted.text;
NSString *quoteString = quoteQuoted.text;
NSMutableDictionary *quotesDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys: sourceString, @"Source", quoteString, @"Quote", nil];
[masterView addQuotationWithDictionary:quotesDict]; //Error occurs here
NSLog(@"%@", quotesDict);
}
}
Thank you in advance for any and all help! 提前感谢您的帮助!
You didn't declare your method in header file. 您没有在头文件中声明您的方法。 Add
加
-(void)addQuotationWithDictionary: (NSMutableDictionary *)myDictionary;
to QuoteMasterViewController.h file between @interface QuoteMasterViewController
and @end
. @interface QuoteMasterViewController
和@end
之间的QuoteMasterViewController.h文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.