0

当呈现模态视图以允许选择地址簿时。我收到错误

No visible @interface uiScrollView declares selector for modal presented animated

这里

[self presentModalViewController:picker animated:YES];

我想我需要使用performSelector:@selector以下帖子中的研究

Objective-C 调用编译器不相信存在的选择器(即使我们知道它存在)

但是我不确定如何在我的代码中实现

 - (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;
}
4

1 回答 1

0

这对你没有任何好处,因为正如错误所说,滚动视图没有实现该方法。它会以同样的方式失败。而不是self(我怀疑你是 UIScrollView),使用对UIViewController.

作为旁注,根据文档,您现在应该使用:

- (void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion

如果您没有完成块,您可以通过这种方式调用它:

[myViewController presentViewController:picker animated:YES completion:NULL];

于 2012-12-27T17:40:58.783 回答