草庐IT

make_member_delegate

全部标签

ios - MFMailComposeViewController 不发送电子邮件或调用委托(delegate) (MFMailComposeViewControllerDelegate)

我有一个MFMailComposeViewController设置并显示如下:classMyViewController:UIViewController{//MARK:-PropertiesletcomposeViewController=MFMailComposeViewController()//MARK:-Actions@IBActionfuncdidTapSendInEmailButton(){composeViewController.mailComposeDelegate=selfcomposeViewController.setToRecipients([Constan

ios - Swift:我在 "Unexpectedly found nil "中得到了 "tableView.delegate=self"

我在按钮和ViewController之间连接了一个segue,如屏幕截图所示。一切正常,直到我将类选为“ViewController”。每次单击“添加”按钮时,代码都会崩溃并出现以下错误:“线程1:fatalerror:在展开可选值时意外发现nil”我现在很迷茫。谁能帮我这个? 最佳答案 您正在崩溃,因为TableView未连接为IBOutlet。您需要将TableViewIBOutlet连接到ViewController。您可以通过右上角的助手编辑器(相互交叉的双圆按钮)并通过右键单击从TableView拖放到ViewContr

swift - 如何将 Delegate 转换为 Observable RxSwift?

我有委托(delegate)方法,我需要通过RxSwift中的委托(delegate)代理来包装这些方法。我已经使用Bond和Reactive完成了它,但是在这里,在RxSwift中,我无法找到转换它的正确方法。遵循协议(protocol)importUIKit/**Aprotocolforthedelegateofa`DetailInputTextField`.*/@objcpublicprotocolCardInfoTextFieldDelegate{/**Calledwhenevervalidinformationwasenteredinto`textField`.-parame

ios - 在 UIView 子类中声明的委托(delegate)在 UIViewController 中不起作用?

我正在尝试创建一个可重用的UIView,我可以将其放置在多个UIViewController中。我给了它委托(delegate)方法,我希望父UIViewControllers访问它,但它抛出一个错误(在下面的代码中注释)。有什么更好的方法可以解决这个问题?importUIKitclassViewController:UIViewController{@IBOutletweakvarcameraView:CameraView!overridefuncviewDidLoad(){super.viewDidLoad()self.cameraView.delegate=self//ERROR

ios - 无法覆盖 Swift 中的委托(delegate)属性

我正在尝试制作一个类似于ImagePickerController的StudentPickerController:classStudentPickerController:UINavigationController,NSCoding{unowned(unsafe)vardelegate:protocol?}@objcprotocolStudentPickerControllerDelegate:NSObjectProtocol{optionalfuncstudentPickerControllerDidFinishPickingStudent(student:Student)opt

swift - C 中的 offsetof(struct, member) 在 Swift 中的等价物是什么?

这是Swift中的一个结构体:structA{varxvaryvarz}我应该怎么做才能得到结构A中y的偏移量,就像C中的offsetof(A,y)一样?谢谢:) 最佳答案 MemoryLayout.offset(of:)是在Swift4.2中添加的,实现了SE-0210Addanoffset(of:)methodtoMemoryLayout例子:structA{varx:Int8vary:Int16varz:Int64}MemoryLayout.offset(of:\A.x)//0MemoryLayout.offset(of:\A

swift - '(key : AnyObject, value: AnyObject )' does not have a member named ' 下标'

我有一个类似于thisquestion的问题,但那里的答案对我没有帮助。我有这些代码行:varid=item["id"]as?String??""varname=item["name"]as?String??""varpic=item["pic"]as?String??""对我来说,这些代码行几乎是一样的。对于Xcode,这是另一回事。第一行没问题。后两行生成此错误:'(key:AnyObject,value:AnyObject)'doesnothaveamembernamed'subscript'这里为大家提供更多背景信息:classfuncgetFromJson(json:NSDi

iphone - UITableViewController 委托(delegate)在 swift 中给出错误

我在SwiftXcode6.1中为UITableView编写简单代码时遇到以下错误/Users/classic/Documents/CIPL/DemoProjects/DemoTableView/DemoTableView/ViewController.swift:11:1:Type'ViewController'doesnotconformtoprotocol'UITableViewDataSource'/Users/classic/Documents/CIPL/DemoProjects/DemoTableView/UIKit.UITableViewDataSource:3:48:P

ios - 如何在 swift 中从下载委托(delegate)更新 gui(进度 View )

我有一个DownloadSessionDelegate类来处理大文件的下载过程。我想在进度View中显示进度。有关下载状态的信息在我的DownloadSessionDelegate类中。现在我不知道如何在该类(class)之外更新我的进度View。如何做到这一点?classDownloadSessionDelegate:NSObject,NSURLSessionDelegate,NSURLSessionDownloadDelegate{varhandlerQueue:[String:CompleteHandlerBlock]!.........funcURLSession(sessio

ios - 找不到成员(member)标志(快速,解析)

if(PFUser.currentUser()==nil){self.loginViewController.fields=PFLogInFields.UsernameAndPassword|PFLogInFields.LogInButton|PFLogInFields.SignUpButton|PFLogInFields.PasswordForgotten|PFLogInFields.DismissButtonvarlogInLogoTitle=UILabel()logInLogoTitle.text="Test"self.logInViewController.logInView.