草庐IT

BugTest_ViewController

全部标签

ios - 在 .xib 所有者的 ViewController 中为 textField 设置委托(delegate)

我正在尝试使用xib文件来显示自定义更改View。为此,我使用here中的SimpleAlert。我有.xib文件,其中包含我的文本字段,作为.xib的所有者,我设置了ViewController。importUIKitclassTestBaumViewController:UIViewController,UITextFieldDelegate{@IBOutletweakvartfFirst:UITextField!@IBOutletweakvartfSecond:UITextField!@IBOutletweakvartfThird:UITextField!@IBOutletwea

ios - 在两个不相关的ViewController之间传递数据

我面临一个挑战,需要在两个(或多个)不相关(通过segue)视图控制器之间来回传递数据。有三个视图控制器,ViewControllerA-ViewControllerB和ViewControllerC。ViewControllerAsegues为ViewControllerB,ViewControllerBsegues为ViewControllerC。我想在ViewControllerA和ViewControllerC之间来回共享数据(例如文本字段中的文本)经过调查,我发现了四种可能的实现方法:委派。使用static成员创建一个类,以存储文本字段中包含的数据。使用NSUserDefau

ios - ViewController 不符合 Swift 中的 GMSAutoCompleteViewControllerDelegate 协议(protocol)

我收到错误:“ViewController”不符合以下代码中的协议(protocol)“GMSAutoCompleteViewControllerDelegate”。classMapViewController:UIViewController,CLLocationManagerDelegate,GMSMapViewDelegate,GMSAutocompleteViewControllerDelegate{...@IBActionfuncautocompleteClicked(sender:AnyObject){letautoCompletController=GMSAutocomp

ios - 在 http 响应回调后移动到另一个 ViewController

我是一个敏捷的新手。我想在http响应回调后移动到另一个新的ViewController。我试过..使用segue或委托(delegate)协议(protocol)当我在Storyboard上创建一个segue时,(使用ctrl按钮并拖动)移动到另一个ViewController比http响应回调更快。因此响应数据不会显示在新的ViewController上使用instantiateViewController()和present()函数“非主线程上没有”错误classRequestViewController:UIViewController{...@IBActionfuncrequ

ios - 在 Swift 中从 Tableviewcell 中关闭 Popover ViewController

在我的iOS8应用程序中,我有一个自定义的ViewController,我将其显示为Popover。这个ViewController有一个委托(delegate),它获取并发送给父ViewController,弹出窗口中的点击索引。问题是我无法在selectRow之后关闭此Popover。代码如下:这是我想显示弹出窗口时调用的方法。@IBActionfuncregisterButtonAction(sender:UIButton){popup=self.storyboard!.instantiateViewControllerWithIdentifier("PopupViewContr

swift - 通过 appDelegate openURL 函数呈现 viewController(在导航层次结构中)

我的初始ViewController是一个登录页面,它检查当前用户是否已登录。如果是,则对下一个View执行segue,这是一个选项卡栏Controller,其默认选择的选项卡是一个TableView(已嵌入导航Controller中)。在这个TableView中是一个事件对象列表。当用户选择一个事件对象时,事件详细信息显示在新View中,导航栏出现在上方,允许用户返回到他们的事件列表。这一切都正常工作。但是,该应用程序具有允许通过URL启动它的URL方案。在我的应用程序委托(delegate)中,我能够捕获我需要的URL方案和查询。我的问题是当我尝试呈现必要的ViewControll

ios - 类型 "ViewController"不符合协议(protocol) 'UITableViewDataSource"

我在编码时遇到错误,说Type"ViewController"doesnotconformtoprotocol"UITableViewDataSource"谁能告诉我这是哪里出了问题?importUIKitclassViewController:UIViewController,UITableViewDataSource{letdevCourses=[("Math"),("Science"),("English"),("ComputerProgramming"),("Physics")]funcnumberOfSectionsInTableview(tableview:UITableV

ios - 在 iOS 应用程序中打开包含 PDF 文件的 ViewController 时出现奇怪的控制台输出

我有一个带有WebView的ViewController。我正在使用以下代码在其中加载PDF文件:overridefuncviewDidLoad(){letpath:String=NSBundle.mainBundle().pathForResource("file",ofType:"pdf")!leturl:NSURL=NSURL.fileURLWithPath(path)letrequest:NSURLRequest=NSURLRequest(URL:url)MagazineInWebView.loadRequest(request)MagazineInWebView.scales

ios - Xcode Swift Playgrounds - 如何为 ViewController 设置默认大小

我有一个在Mac上构建的Playground,但也打算在iPad版本上使用。我有一个UIViewController,我在上面显示我的所有内容。在iPadPlayground上,此ViewController会自动调整大小以适应实时View的区域。这就是我要的。尽管在计算机上,UIViewController(以编程方式创建)仅占用iPhone7的空间。我想要一个iPad大小的区域,以便我可以在更大的范围内测试我的内容。我将如何着手执行此操作(例如:为Xcode设置默认大小,但在iPad上保持该行为)。谢谢,将 最佳答案 今天刚遇到

ios - 从 viewController 访问或引用 UIImageView

这里是iOS/Swift新手。我的storyBoard上有一个View(或UIImageView,我认为这不重要),我需要在我的viewController代码中引用它。我该怎么做?为什么?我正在尝试在非全屏的“View”中显示相机预览。我正在为相机使用示例代码,其中包括此代码funcbeginSession(){varerr:NSError?=nilcaptureSession.addInput(AVCaptureDeviceInput(device:captureDevice,error:&err))iferr!=nil{println("error:\(err?.localize