草庐IT

UiviewController

全部标签

swift - 将 UIViewController 呈现为具有透明背景的模态

我试图在iOS7和iOS8上呈现一个具有透明背景的ViewController。只需将viewcontroller的modalPresentationStyle属性更改为FormSheet,我就可以让它在iOS7.1上运行。我想要的是在ios7+上通用的方法我尝试过使用其他选项来设置modalPresentationStyle,例如:OverCurrentContext、CurrentContext和PageSheet。我也尝试使用modalPresentationStyle.Custom但没有成功。如果有任何帮助,我有NavigationController。呈现ViewContro

ios - UIViewController 扩展不允许覆盖 Swift 中的 View 相关功能?

在尝试为UIViewController实现扩展时,我意识到没有正常的方法,或者不允许覆盖此功能(即使它们可用于UICollectionViewController和UITableViewController):extensionUIViewController{publicoverridefuncviewWillAppear(){super.viewWillAppear()//dosomestuff}}我意识到没有正常的方法,或者不允许重写这个函数(即使它们可用于UICollectionViewController和UITableViewController):viewDidLoad

ios - UIViewController 扩展不允许覆盖 Swift 中的 View 相关功能?

在尝试为UIViewController实现扩展时,我意识到没有正常的方法,或者不允许覆盖此功能(即使它们可用于UICollectionViewController和UITableViewController):extensionUIViewController{publicoverridefuncviewWillAppear(){super.viewWillAppear()//dosomestuff}}我意识到没有正常的方法,或者不允许重写这个函数(即使它们可用于UICollectionViewController和UITableViewController):viewDidLoad

swift - 如何获得 View 的中心

我试图通过使用下面的代码获得我的View的中心,正在使用的类来自DTIActivityIndi​​catorView,它将自定义事件指示器添加到View。varmidX=CGRectGetMidX(self.view.bounds)varmidY=CGRectGetMidY(self.view.bounds)lettopStoriesActivityIndicator:DTIActivityIndicatorView=DTIActivityIndicatorView(frame:CGRect(x:midX,y:midY,width:80.0,height:80.0))但上面的代码给出了

swift - 如何获得 View 的中心

我试图通过使用下面的代码获得我的View的中心,正在使用的类来自DTIActivityIndi​​catorView,它将自定义事件指示器添加到View。varmidX=CGRectGetMidX(self.view.bounds)varmidY=CGRectGetMidY(self.view.bounds)lettopStoriesActivityIndicator:DTIActivityIndicatorView=DTIActivityIndicatorView(frame:CGRect(x:midX,y:midY,width:80.0,height:80.0))但上面的代码给出了

ios - UIDocumentMenuViewController 取消呈现 View Controller

我有一个模态呈现VC“B”的VC“A”。B呈现一个UIDocumentMenuViewControllerUIDocumentMenuDelegate协议(protocol)在B中实现。一旦documentMenuWasCancelled(_documentMenu:)或documentMenu(_:didPickDocumentPicker:)被调用dismiss(animated:completion:)B的被调用,我不知道为什么。这是我的代码funcpresentDocumentPicker(){letdocumentTypes=[kUTTypeCompositeContenta

ios - UIDocumentMenuViewController 取消呈现 View Controller

我有一个模态呈现VC“B”的VC“A”。B呈现一个UIDocumentMenuViewControllerUIDocumentMenuDelegate协议(protocol)在B中实现。一旦documentMenuWasCancelled(_documentMenu:)或documentMenu(_:didPickDocumentPicker:)被调用dismiss(animated:completion:)B的被调用,我不知道为什么。这是我的代码funcpresentDocumentPicker(){letdocumentTypes=[kUTTypeCompositeContenta

ios - 更改 ViewController Swift 的背景颜色? (单 View 应用程序)

我正在使用Swift(XCode6.2)制作一个非常简单的单View应用程序,它包含2个按钮“blackButton”和“whiteButton”。单击blackButton后,它会将View的背景颜色更改为黑色,单击whiteButton后,它会将背景更改为白色。谁能建议任何可能的方法来做到这一点?ViewController.swift://beginningimportUIKitclassViewController:UIViewController{@IBActionfuncblackButton(sender:AnyObject){}@IBActionfuncwhiteBut

ios - 更改 ViewController Swift 的背景颜色? (单 View 应用程序)

我正在使用Swift(XCode6.2)制作一个非常简单的单View应用程序,它包含2个按钮“blackButton”和“whiteButton”。单击blackButton后,它会将View的背景颜色更改为黑色,单击whiteButton后,它会将背景更改为白色。谁能建议任何可能的方法来做到这一点?ViewController.swift://beginningimportUIKitclassViewController:UIViewController{@IBActionfuncblackButton(sender:AnyObject){}@IBActionfuncwhiteBut

swift - 协议(protocol)扩展中的 'where self' 是什么

我看到了很多格式如下的例子extensionProtocolnamewhereSelf:UIViewController协议(protocol)扩展中的whereSelf是什么。我找不到这方面的文档。 最佳答案 语法是:https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Protocols.html#//apple_ref/doc/uid/TP40014097-CH25-ID521考