Advertisement
iamalizade

1

Jul 28th, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.64 KB | None | 0 0
  1. class ViewController: UIViewController, UITableViewDataSource {
  2.     var myView: UIView!
  3.  
  4.     override func viewDidLoad() {
  5.     super.viewDidLoad()
  6.  
  7.     var myView = UIView(frame: CGRectMake((width-50)/2, (height-50)/2, 50, 50))
  8.     myView.backgroundColor = UIColor(red: 16/255.0, green: 57/255.0, blue: 100/255.0, alpha: 0.9)
  9.     myView.layer.cornerRadius = 16
  10.  
  11.     self.view.addSubview(myView)
  12.     myView.alpha = 0
  13.     }
  14.  
  15.     func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
  16.         self.myView.alpha = 1 // <-- Error: fatal error: unexpectedly found nil while unwrapping an Optional value
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement