         searchBarController.data = stringArrayToTags(initialTags())
         
         self.addChildViewController(searchBarController)
-        contentStackView.insertArrangedSubview(searchBarController.view, atIndex: index)
-        searchBarController.view.translatesAutoresizingMaskIntoConstraints = false
-        
-        searchBarHeightConstraint = NSLayoutConstraint(expressionFormat: "self.height = 190", parameters: ["self": searchBarController.view])
-        searchBarController.view.addConstraint(searchBarHeightConstraint)
+        tagScrollView.addSubview(searchBarController.view)
+        
+        constraints = []
+        dict = ["self": searchBarController.view, "super": tagScrollView]
+        constraints.append(NSLayoutConstraint(expressionFormat: "self.left = super.left", parameters: dict))
+        constraints.append(NSLayoutConstraint(expressionFormat: "self.right = super.right", parameters: dict))
+        constraints.append(NSLayoutConstraint(expressionFormat: "self.top = super.top", parameters: dict))
+        constraints.append(NSLayoutConstraint(expressionFormat: "self.bottom = super.bottom", parameters: dict))
+        tagScrollView.addConstraints(constraints)
+
+        searchBarController.scrollEnabled = false
+        searchBarController.view.translatesAutoresizingMaskIntoConstraints = true
+        var frame = searchBarController.view.frame
+        frame.size.width = 2000
+        frame.size.height = tagScrollView.frame.height
+        searchBarController.view.frame = frame
+        /*
+        
+        searchBarController.view.setNeedsLayout()
+        searchBarController.view.layoutIfNeeded()
+        let size = searchBarController.contentSize()
+        let delta = (tagScrollView.frame.size.width / 3.0)
+        frame.size.width = size.width + delta
+        searchBarController.view.frame = frame*/
+
+        var textFieldFrame = searchTextField.frame
+        textFieldFrame.size.height = 34
+        searchTextField.frame = textFieldFrame
+
+        
+//        searchTextField.backgroundColor = UIColor.cyanColor()
+//        tagScrollView.backgroundColor = UIColor.yellowColor()
+//        searchBarController.view.backgroundColor = UIColor.greenColor()
+        
+    }
+    
+    override func viewDidLayoutSubviews()
+    {
+        super.viewDidLayoutSubviews()
+        self.searchBar.layoutIfNeeded()
+        self.searchBar.layoutSubviews()
+        
+//        var searchBarFrame = searchBar.frame
+        let newHeight: CGFloat = 36 //desired textField Height.
+        for subView in searchBar.subviews
+        {
+            for subsubView in subView.subviews
+            {
+                if let textField = subsubView as? UITextField
+                {
+                    var currentTextFieldBounds = textField.bounds
+                    currentTextFieldBounds.size.height = newHeight
+                    textField.bounds = currentTextFieldBounds
+                    textField.borderStyle = UITextBorderStyle.RoundedRect
+                    //textField.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
+                }
+            }
+        }
     }
     
     internal func setupTagBarViewControllerAtIndex(index: Int) {

        
        let config = SnapTagsViewConfiguration()
        config.spacing = 5.0 as CGFloat
        config.horizontalMargin = 5.0 as CGFloat
        config.verticalMargin = 5.0 as CGFloat
        config.contentHeight = 13.0 as CGFloat
        config.alignment = .Left
        //        config.alignment = .Natural

        let leftAlignedMixedOnOffContentSize = leftAlignedMixedOnOffCollectionViewController.contentSize()
        leftAlignedMixedOnOffCollectionViewHeightConstraint.constant = leftAlignedMixedOnOffContentSize.height
        
        searchBarController.scrollEnabled = true
//        let searchBarContentSize = searchBarController.contentSize()
//        searchBarHeightConstraint.constant = searchBarContentSize.height

        tagBarViewController.scrollEnabled = false
        let tagBarContentSize = tagBarViewController.contentSize()
