Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. var photos:NSArray = []
  2. var imageArr:NSArray=[]
  3. override func viewDidLoad() {
  4. super.viewDidLoad()
  5. // Do any additional setup after loading the view, typically from a nib.
  6. photos=["Waves", "Storm", "Crackling Fire", "Dry Leaves", "Water"]
  7. imageArr=[UIImage(named: "1")!,UIImage(named:"2")!,UIImage(named:"3")!,UIImage(named:"4")!,UIImage(named:"5")!]
  8. //for new thumbnails and names
  9. func addBlurEffect(toView view:UIView?) {
  10. // Add blur view
  11. guard let view = view else { return }
  12.  
  13. //This will let visualEffectView to work perfectly
  14. if let navBar = view as? UINavigationBar{
  15. navBar.setBackgroundImage(UIImage(), for: .default)
  16. navBar.shadowImage = UIImage()
  17. }
  18.  
  19.  
  20. var bounds = view.bounds
  21. bounds.offsetBy(dx: 0.0, dy: -20.0)
  22. bounds.size.height = bounds.height + 20.0
  23.  
  24. let blurEffect = UIBlurEffect(style: .dark)
  25. let visualEffectView = UIVisualEffectView(effect: blurEffect)
  26.  
  27. visualEffectView.isUserInteractionEnabled = false
  28. visualEffectView.frame = bounds
  29. visualEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
  30. view.insertSubview(visualEffectView, at: 0)
  31.  
  32. }
  33. addBlurEffect(toView: self.navigationController?.navigationBar)
  34. }
  35. override func didReceiveMemoryWarning() {
  36. super.didReceiveMemoryWarning()
  37. }
  38. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  39. return photos.count
  40. }
  41.  
  42. }
  43. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  44. let cell = tableView.dequeueReusableCell(withIdentifier: "SongTableViewCell") as! SongTableViewCell
  45. cell.coverImageView.image=imageArr[indexPath.row]
  46. cell.songTitleLabel.text!=photos[indexPath.row]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement