我正在使用以下代碼來使用集合加載我的表。點擊按鈕取消視圖
self.window = UIWindow(frame: CGRect(x:40, y:120, width:self.view.bounds.width-100, height:self.view.bounds.height-200))
self.window!.backgroundColor = UIColor.whiteColor()
let mainController : CollectionViewController = CollectionViewController(nibName: "CollectionViewController", bundle: nil)
myController.TableHeaderArray = TableHeaders
let ApiResponse = self.dataTableViewdictParams(apiUrl)
myController.UMIDDataArray = ApiResponse[0] as! NSMutableArray
myController.TableDataArray = ApiResponse[1] as! NSMutableArray
self.window!.rootViewController = myController
self.window!.makeKeyAndVisible()
我想刪除此表上的按鈕點擊並加載另一個視圖。在按鈕上單擊另一個視圖被加載,但我無法刪除此表UIWindowView。我該如何刪除它?
編輯:
我試過添加代碼:
function loadanotherView()
{
/// I tried these three codes but none worked for me
self.window?.removeFromSuperview() // code 1
self.window?.rootViewController?.removeFromParentViewController() // code 1
self.window?.hidden = true // code 2
let frame = CGRect(x:0, y:-20, width:self.view.bounds.width, height:self.view.bounds.width)
WView.frame=frame
let url = NSURL(string:"urlForTheWebView")
let req = NSURLRequest(URL:url!)
self.webView!.loadRequest(req)
self.view.addSubview(WView)
}
用你的刪除按鈕點擊方法更新你的問題 –
添加按鈕點擊方法 – dang
'tableView.dismissViewController()' –