没有可见的@inter接口声明选择器“dismissModalViewControllerAnimated”

时间:2012-10-23 21:54:48

标签: objective-c ios xcode

我得到no visible @ interface for "ICMinorWorksPart1" declares the selector "dismissModalViewControllerAnimated"以下内容:

[self presentModalViewController:picker animated:YES];
[self dismissModalViewControllerAnimated:YES];
[self dismissModalViewControllerAnimated:YES];

我只是无法解决编译器抱怨的问题?

·H

#import <AddressBookUI/AddressBookUI.h>

@interface ICMinorWorksPart1 : ICCertificateComponent   <UITextViewDelegate,ABPeoplePickerNavigationControllerDelegate>

.....

的.m

 #import "ICMinorWorksPart1.h"




@implementation ICMinorWorksPart1
@synthesize dateMinorWorksCompletedField=_dateMinorWorksCompletedField;
@synthesize certificateReferenceField=_certificateReferenceField;
@synthesize clientField=_clientField;
@synthesize detailsOfDeparturesField=_detailsOfDeparturesField;
@synthesize descriptionOfMinorWorksField=_descriptionOfMinorWorksField;
@synthesize addressOfTheMinorWorks=_addressOfTheMinorWorks;

 - (id)initWithCertificate:(Certificate *)certificate
 {




if ((self = [super initWithCertificate:certificate])) {
    [[NSBundle mainBundle] loadNibNamed:@"MinorWorksPart1" owner:self options:nil];
    self.view.contentSize = CGSizeMake(self.contentView.frame.size.width, self.contentView.frame.size.height);

    self.dateMinorWorksCompletedField.textValue = ([self attributeWithName:@"dateMinorWorksCompleted"]).value;

    DebugLog(@"dateMinorWorksCompleted attribute value is %@", ([self attributeWithName:@"dateMinorWorksCompleted"]).value);
    DebugLog(@"Certificate reference is %@", self.certificate.reference);
    self.certificateReferenceField.text = (self.certificate.reference != nil ? self.certificate.reference : @"");
    self.clientField.text = ([self attributeWithName:@"client"]).value;
    self.detailsOfDeparturesField.text = ([self attributeWithName:@"detailsOfDepartures"]).value;
    self.addressOfTheMinorWorks.text = ([self attributeWithName:@"addressOfTheMinorWorks"]).value;
    self.descriptionOfMinorWorksField.text = ([self attributeWithName:@"descriptionOfMinorWorks"]).value;
 }
return self;





 }

- (void)save
 {
([self attributeWithName:@"dateMinorWorksCompleted"]).value = [ICUtils nonNilString:self.dateMinorWorksCompletedField.textField.text];
DebugLog(@"dateMinorWorksCompleted value is %@", self.dateMinorWorksCompletedField.textField.text);
self.certificate.reference = [ICUtils nonNilString:self.certificateReferenceField.text];
([self attributeWithName:@"client"]).value = [ICUtils nonNilString:self.clientField.text];
([self attributeWithName:@"detailsOfDepartures"]).value = [ICUtils nonNilString:self.detailsOfDeparturesField.text];
([self attributeWithName:@"addressOfTheMinorWorks"]).value = [ICUtils nonNilString:self.addressOfTheMinorWorks.text];
([self attributeWithName:@"descriptionOfMinorWorks"]).value = [ICUtils nonNilString:self.descriptionOfMinorWorksField.text];
 }





//add adress
- (IBAction)addAddressBtn:(id)sender {


ABPeoplePickerNavigationController *picker =

[[ABPeoplePickerNavigationController alloc] init];

picker.peoplePickerDelegate = self;

[self presentModalViewController:picker animated:YES];


}

- (void)peoplePickerNavigationControllerDidCancel:


(ABPeoplePickerNavigationController *)peoplePicker
{
[self dismissModalViewControllerAnimated:YES];
 }


 - (BOOL)peoplePickerNavigationController:
(ABPeoplePickerNavigationController *)peoplePicker
  shouldContinueAfterSelectingPerson:(ABRecordRef)person {

[self displayPerson:person];
[self dismissModalViewControllerAnimated:YES];

return NO;
}

 - (BOOL)peoplePickerNavigationController:
 (ABPeoplePickerNavigationController *)peoplePicker
  shouldContinueAfterSelectingPerson:(ABRecordRef)person
                            property:(ABPropertyID)property
                          identifier:(ABMultiValueIdentifier)identifier
{
return NO;
}

1 个答案:

答案 0 :(得分:2)

如果ICMinorWorksPart1类的超类(ICCertificateComponent)不是UIViewController的子类,则错误为真,因为dismissModalViewControllerAnimated:UIViewController的方法类。

此外,iOS 6中不推荐使用presentModalViewController:animated:类的dismissModalViewControllerAnimated:UIViewController方法,因此您可能也需要注意这一点。