//
//  WeixinQQView.swift
//  SYMobilePortal
//
//  Created by xiejiangbo on 2018/5/10.
//  Copyright © 2018年 yin chen. All rights reserved.
//

import UIKit

class WeixinQQViewTwo: UIView {

    var weixinBtn:UIButton!
    var weixinLabel:UILabel!
    var qqBtn:UIButton!
    var qqLabel:UILabel!
    
    var lineLabel:UILabel!
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        initLinView()
        initWeixinQQView()
    }

    override func layoutSubviews() {
        
        
    }
    func initLinView(){
        let leftView:UIImageView = self.getLinViewImage()
        leftView.frame = CGRect(x:WHIDTH_RATIO()*63, y: 0, width:SCREEN_WHIDTH()-WHIDTH_RATIO()*126 , height:HEIGHT_RATIO()*1)
        self.addSubview(leftView)
        
        lineLabel = UILabel.init(frame: CGRect(x:WHIDTH_RATIO()*28, y: 37*HEIGHT_RATIO(), width:WHIDTH_RATIO()*160 , height:HEIGHT_RATIO()*14))
        lineLabel.centerX = self.centerX
        lineLabel.text = "您也可以用以下方式登录"
        lineLabel.textColor = grayColor
        lineLabel.backgroundColor = UIColor.white
        lineLabel.font = UIFont.test_systemFont(ofSize: 11.0)
        lineLabel.textAlignment = .center
        self.addSubview(lineLabel)
        
//        let rightView:UIImageView = self.getLinViewImage()
//        rightView.frame = CGRect(x:self.width-WHIDTH_RATIO()*110, y: 0, width:WHIDTH_RATIO()*33 , height:HEIGHT_RATIO()*1)
//        self.addSubview(rightView)
        
//        rightView.centerY = lineLabel.centerY
        leftView.centerY = lineLabel.centerY
    }
    
    func initWeixinQQView(){
        
        qqBtn = self.getUIButton()
        qqBtn.setBackgroundImage(UIImage.init(named: "qq_image"), for: .normal)
        qqBtn.frame = CGRect(x:SCREEN_WHIDTH()-26*WHIDTH_RATIO()-WHIDTH_RATIO()*33, y: 0, width:WHIDTH_RATIO()*33 , height:WHIDTH_RATIO()*33)
        qqBtn.centerY = lineLabel.centerY
//        self.addSubview(qqBtn)
        
        weixinBtn = self.getUIButton()
        weixinBtn.setBackgroundImage(UIImage.init(named: "weiChat_two_image"), for: .normal)
//        weixinBtn.frame = CGRect(x:SCREEN_WHIDTH()-26*WHIDTH_RATIO()-WHIDTH_RATIO()*33-26*WHIDTH_RATIO()-WHIDTH_RATIO()*33, y: 0, width:WHIDTH_RATIO()*33 , height:WHIDTH_RATIO()*33)
        weixinBtn.frame = CGRect(x:0, y: lineLabel.originY+lineLabel.height+33*HEIGHT_RATIO(), width:WHIDTH_RATIO()*43 , height:WHIDTH_RATIO()*43)
        weixinBtn.centerX = self.centerX
        self.addSubview(weixinBtn)

//        weixinLabel = UILabel.init(frame: CGRect(x:weixinBtn.originX, y: weixinBtn.originY+weixinBtn.height+10*HEIGHT_RATIO(), width:weixinBtn.width , height:HEIGHT_RATIO()*13))
//        weixinLabel.text = "微信"
//        weixinLabel.textColor = grayColor
//        weixinLabel.font = UIFont.systemFont(ofSize: 13*WHIDTH_RATIO())
//        weixinLabel.textAlignment = .center
//        self.addSubview(weixinLabel)
        
        
//        qqLabel = UILabel.init(frame: CGRect(x:qqBtn.originX, y: weixinBtn.originY+weixinBtn.height+10*HEIGHT_RATIO(), width:weixinBtn.width , height:HEIGHT_RATIO()*13))
//        qqLabel.text = "QQ"
//        qqLabel.textColor = grayColor
//        qqLabel.font = UIFont.systemFont(ofSize: 13*WHIDTH_RATIO())
//        qqLabel.textAlignment = .center
//        self.addSubview(qqLabel)
//        self.addSubview(weixinLabel)
        
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    func getLinViewImage() -> UIImageView{
        let lineImageView = UIImageView.init()
        lineImageView.image = UIImage.init(named: "textViewLine_image")
        return lineImageView
    }
    

    func getUIButton() -> UIButton{
        let btn = UIButton.init(type: .custom)
        btn.contentMode = .scaleToFill
        return btn
    }
}
