         
         context.invalidateSupplementaryElementsOfKind(UICollectionElementKindSectionHeader,atIndexPaths:invalidatedIndexPaths)
 
+        println("invalidationContextForBoundsChange(\(newBounds)) \(invalidatedIndexPaths) contentInset.top = \(collectionView.contentInset.top)")
+
+        
         return context
     }
     

        let attrs = self.sectionHeadersAttributes[forIndex]
        attrs.frame = CGRectMake(0, offset, attrs.frame.size.width, attrs.frame.size.height)
        attrs.zIndex = 1024
    }
    
    override func invalidationContextForBoundsChange(newBounds: CGRect) -> UICollectionViewLayoutInvalidationContext {
        
//        println("invalidationContextForBoundsChange(\(newBounds))")
        
        var context = super.invalidationContextForBoundsChange(newBounds)

        // здесь инвалидируем конкретный аттрибут - выставляем его новые значения!,
        let collectionView = self.collectionView!
        
        let offset:CGFloat = newBounds.origin.y + collectionView.contentInset.top
        let index = indexForOffset(offset)
        
        var invalidatedIndexPaths = [NSIndexPath(forItem: 0, inSection:index)];
        
        self.setFloatingHeaderOffset(offset, forIndex: index)
        
        if let floatingSectionIndex = self.floatingSectionIndex {
            if (self.floatingSectionIndex != index){
                invalidatedIndexPaths.append(NSIndexPath(forItem: 0, inSection:floatingSectionIndex))

    var sectionHeadersAttributes:Array<UICollectionViewLayoutAttributes!> = []
    let offsets = NSMutableOrderedSet()
    var floatingSectionIndex:Int! = nil
    var previousWidth:CGFloat! = nil
    
    override func shouldInvalidateLayoutForBoundsChange(newBounds: CGRect) -> Bool {
        return true
    }
    
    func calculateHeaders(){
        self.sectionHeadersAttributes.removeAll(keepCapacity: true)
        self.offsets.removeAllObjects()
        
        let collectionView = self.collectionView!
        
        let numberOfSections = collectionView.numberOfSections()
        for var section = 0; section < numberOfSections; ++section {
            
            let attr =  super.layoutAttributesForSupplementaryViewOfKind(UICollectionElementKindSectionHeader,atIndexPath:NSIndexPath(forItem: 0, inSection: section))
            self.sectionHeadersAttributes.append(attr)
            
            if (section > 0){
                self.offsets.addObject(attr.frame.origin.y)
            }
        }
        

    }
    
    func setOffsetOfFloatingHeader(){
        let collectionView = self.collectionView!
        let offset:CGFloat = collectionView.contentOffset.y + collectionView.contentInset.top
        let index = indexForOffset(offset)
        self.setFloatingHeaderOffset(offset, forIndex: index)
    }
    
    override func layoutAttributesForElementsInRect(rect: CGRect) -> [AnyObject]? {

        println("layoutAttributesForElementsInRect \(rect) ... ")
        println("1contentInset.top = \(self.collectionView!.contentInset.top) .....")
        
        setOffsetOfFloatingHeader()

        let attrs = super.layoutAttributesForElementsInRect(rect)
        
        let ret = attrs?.map() {
            
            (attribute) -> UICollectionViewLayoutAttributes in
            
