         fatalError("init(coder:) has not been implemented")
     }
     
-    
     override public func layoutSubviews() {
-        super.layoutSubviews();
-        
-        let bounds = self.bounds;
-        self.width = bounds.size.width;
-        self.height = bounds.size.height;
-        
-        toolBarView?.frame = CGRect(x:0,y:0,width:self.width!,height:toolBarViewHeight);
-        donebutton?.frame = CGRect(x:width! - 40 - 10,y:(toolBarViewHeight - 20)/2,width:40,height:20);
-        
+        super.layoutSubviews()
+        let bounds = self.bounds
+        self.width = bounds.size.width
+        self.height = bounds.size.height
+        toolBarView?.frame = CGRect(x:0,y:0,width:self.width!,height:toolBarViewHeight)
+        donebutton?.frame = CGRect(x:width! - 40 - 10,y:(toolBarViewHeight - 20)/2,width:40,height:20)
         if isProvinceKeyBoard{
             self.creatKeyBoardWithType(buttonType: .BJKeyboardStyleProvince, hidenOrNot: false)
         }else{
-            self.creatKeyBoardWithType(buttonType: .BJKeyboardStyleLetter, hidenOrNot: false);
+            self.creatKeyBoardWithType(buttonType: .BJKeyboardStyleLetter, hidenOrNot: false)
         }
     }
     
     override public func sizeThatFits(_ size: CGSize) -> CGSize {
-        
         var tempSize = CGSize()
         tempSize.width = UIScreen.main.bounds.width
         tempSize.height =  UIScreen.main.bounds.height <= 480 ?
-                           UIScreen.main.bounds.height*0.4 :
-                           UIScreen.main.bounds.height*0.35
+            UIScreen.main.bounds.height*0.4 :
+            UIScreen.main.bounds.height*0.35
         tempSize.height = tempSize.height + toolBarViewHeight
         return tempSize
     }
     
-  private  func creatKeyBoardWithType(buttonType type:BJKeyboardStyle , hidenOrNot hiden:Bool){
-        
-        var array = NSArray()
-        var buttonCount = 0;
+    private  func creatKeyBoardWithType(buttonType type:BJKeyboardStyle , hidenOrNot hiden:Bool){
+        var array = [BJKeyboardButton]() //Array<BJKeyboardButton>
+        var buttonCount = 0
         var tempW = 0.00
         
         switch type {
         case .BJKeyboardStyleProvince:
-            array = provinceArr!
+            array = provinceArr
             buttonCount = 28
             tempW = 0.0
         case .BJKeyboardStyleLetter:
-            array = letterArr!
+            array = letterArr
             buttonCount = 29
             tempW = 0.5
         }
         
         height = height! - toolBarViewHeight
-        
         let KeyWidth = (width!/10.0 - kKeyHorizontalSpace*2.0)
-        let KeyHeight = (height!/4.0 - kKeyVerticalSpace*2.0);
-    
+        let KeyHeight = (height!/4.0 - kKeyVerticalSpace*2.0)
         for index in 0...(array.count-1){
-            let btn = array[index] as? BJKeyboardButton
-            btn?.isHidden = hiden
+            let btn = array[index]
+            btn.isHidden = hiden
             var k = index
             var j = index/10
             if index >= 10 && index < buttonCount {

        }
    }
    
     func buttonPlayClick(button:BJKeyboardButton){
        UIDevice.current.playInputClick()
    }
    
   public  var enableInputClicksWhenVisible: Bool {
        return true
    }
    
    func doneButtonAction(button:UIButton){
        if UIResponder.BJCurrentFirstResponder().isFirstResponder{
           UIResponder.BJCurrentFirstResponder().resignFirstResponder()
        }else{
          print("Not Find First responder");
        }
    }

    private func RGBColor(R r:CGFloat,G g:CGFloat,B b:CGFloat) ->(UIColor){
        let color = UIColor(red:r/255.0,green:g/255.0,blue:b/255.0,alpha:1.0);
        return color
    }
    
}

            }
        }
        deleteBtn?.frame = CGRect(x:width! - KeyWidth*1.5 - kKeyHorizontalSpace,
                                  y:height! - KeyHeight - kKeyVerticalSpace+toolBarViewHeight,
                                  width:KeyWidth*1.5,
                                  height:KeyHeight)
        
        changeBtn?.frame = CGRect(x:kKeyHorizontalSpace,
                                  y:height! - KeyHeight - kKeyVerticalSpace+toolBarViewHeight,
                                  width:KeyWidth * 1.5,
                                  height:KeyHeight)
    }
    
    private func setButtonStyle(button:BJKeyboardButton) -> (BJKeyboardButton){
        button.isExclusiveTouch = true
        button.backgroundColor = UIColor.clear
        button.setBackgroundImage(buttonImage, for: .normal)
