这让我抓狂。我正试图在单击按钮时取消隐藏隐藏的UIView,但它不起作用。这是代码
import UIKit
class DownloadViewController: UIViewController {
@IBOutlet var activityView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.activityView.hidden = true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func downloadAction(sender: AnyObject) {
self.activityView.hidden = false
}
}
请帮帮我。这不是一件简单的事,真让我发疯。
确保您的插座连接到Interface Builder中的正确按钮,然后通过ctrl从IB中的按钮拖动到@IBOutlet代码来尝试再次连接。
这段代码有效,是出现错误还是按钮什么都没做?
Swift 3
导入UIKit类DownloadViewController:UIViewController{
@IBOutlet var activityView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.activityView.isHidden = true
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func downloadAction(sender: AnyObject) {
self.activityView.isHidden = false
}
}