             metrics:metrics,
             views:views))
         addConstraints(NSLayoutConstraint.constraints(
-            withVisualFormat:"V:|-20-[cancelButton]-0-|",
+            withVisualFormat:"H:|-0-[spinner]-0-|",
             options:[],
             metrics:metrics,
             views:views))
+        addConstraints(NSLayoutConstraint.constraints(
+            withVisualFormat:"H:[cancelButton(cancelButtonWidth)]",
+            options:[],
+            metrics:metrics,
+            views:views))
+        addConstraints(NSLayoutConstraint.constraints(
+            withVisualFormat:"V:[cancelButton(cancelButtonHeight)]-0-[spinner(spinnerHeight)]-0-[border(1)]-0-|",
+            options:[],
+            metrics:metrics,
+            views:views))
+        
+        layoutCancelButtonLeft = NSLayoutConstraint(
+            item:cancelButton,
+            attribute:NSLayoutAttribute.left,
+            relatedBy:NSLayoutRelation.equal,
+            toItem:self,
+            attribute:NSLayoutAttribute.left,
+            multiplier:1,
+            constant:0)
+        
+        addConstraint(layoutCancelButtonLeft)
+    }
+    
+    override func layoutSubviews()
+    {
+        let width:CGFloat = bounds.maxX
+        let remainCancelButton:CGFloat = width - kCancelButtonWith
+        let marginCancelButton:CGFloat = remainCancelButton / 2.0
+        layoutCancelButtonLeft.constant = marginCancelButton
+        
+        super.layoutSubviews()
     }
     
     //MARK: actions

        translatesAutoresizingMaskIntoConstraints = false
        self.controller = controller
        
        let border:UIView = UIView()
        border.backgroundColor = UIColor.black
        border.isUserInteractionEnabled = false
        border.translatesAutoresizingMaskIntoConstraints = false
        
        let cancelButton:UIButton = UIButton()
        cancelButton.translatesAutoresizingMaskIntoConstraints = false
        cancelButton.setTitleColor(UIColor.black, for:UIControlState.normal)
        cancelButton.setTitleColor(UIColor.white, for:UIControlState.highlighted)
        cancelButton.setTitle(NSLocalizedString("VHomeUploadSyncBar_cancel", comment:""), for:UIControlState.normal)
        cancelButton.titleLabel!.font = UIFont.medium(size:14)
        cancelButton.addTarget(
            self,
            action:#selector(actionCancel(sender:)),

        
        addSubview(border)
        addSubview(cancelButton)
        addSubview(spinner)
        
        let views:[String:UIView] = [
            "border":border,
            "cancelButton":cancelButton]
        
        let metrics:[String:CGFloat] = [
            "spinnerHeight":kSpinnerHeight,
            "cancelButtonWith":kCancelButtonWith,
            "cancelButtonHeight":kCancelButtonHeight]
        
        addConstraints(NSLayoutConstraint.constraints(
            withVisualFormat:"H:|-0-[border]-0-|",
            options:[],
            metrics:metrics,
            views:views))
