MeetingRoomDeviceListView.swift 963 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // MeetingRoomDeviceListView.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 16/8/28.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. class MeetingRoomDeviceListView: UIView {
  10. fileprivate let DEVICE_WIDTH = 12
  11. fileprivate let DEVICE_WIDTH_SPACE = 5
  12. fileprivate let DEVICE_HEIGHT = 12
  13. var deviceList:String?{
  14. didSet {
  15. let dList = deviceList?.components(separatedBy: "#")
  16. let x = 0,y=0
  17. var index = 0
  18. for deviceName in dList! {
  19. let view = UIImageView(image: UIImage(named: "icon_room_\(deviceName)"))
  20. view.frame = CGRect(x: CGFloat(x) + CGFloat(DEVICE_WIDTH) * CGFloat(index) + CGFloat(DEVICE_WIDTH_SPACE), y: CGFloat(y), width: CGFloat(DEVICE_WIDTH), height: CGFloat(DEVICE_HEIGHT))
  21. self.addSubview(view)
  22. index+=1
  23. }
  24. self.layoutIfNeeded()
  25. }
  26. }
  27. }