简体   繁体   English

xcode错误:masterViewController没有可见的@interface声明选择器

[英]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.

相关问题 Xcode错误消息-ViewController没有可见的@interface声明选择器 - Xcode Error Message - No visible @interface for ViewController declares the selector &#39;NSData&#39;没有可见的@interface声明选择器 - No visible @interface for 'NSData' declares the selector &#39;DDExpression&#39;没有可见的@interface声明选择器&#39;evaluateWithSubstitutions:error:&#39;错误 - No visible @interface for 'DDExpression' declares the selector 'evaluateWithSubstitutions:error:' error iOS编译错误:'CDVCommandDelegateImpl'没有可见的@interface声明选择器'execute:' - iOS compile error: no visible @interface for 'CDVCommandDelegateImpl' declares the selector 'execute:' iOS编译错误:“ setLocationManager”没有可见的@interface声明选择器 - iOS compile error: No visible @interface for 'setLocationManager' declares the selector iOS错误:&#39;Project&#39;没有可见的@interface声明选择器&#39;alloc&#39; - iOS error: No visible @interface for 'Project' declares the selector 'alloc' &#39;BlahDataController&#39;没有可见的@interface声明选择器&#39;aMethod: - No visible @interface for 'BlahDataController' declares the selector 'aMethod: &#39;FirstViewController&#39;没有可见的@interface声明选择器&#39;setUIImage&#39; - No visible @interface for 'FirstViewController' declares the selector 'setUIImage' uinavigationcontroller没有可见的接口将选择器pushnavigationitem声明为动画 - no visible interface for uinavigationcontroller declares the selector pushnavigationitem animated 'NSObject <PageControlDelegate>'没有可见的@interface声明选择器'pageControlPageDidChange:' - No visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM