Objective c UICollectionView节头视图没有';在iOS9中不能正确旋转

Objective c UICollectionView节头视图没有';在iOS9中不能正确旋转,objective-c,ios7,uicollectionview,ios9,sectionheader,Objective C,Ios7,Uicollectionview,Ios9,Sectionheader,我有一个为iOS 7开发的餐馆菜单iPad应用程序,它使用横向滚动的collectionView。菜单部分标题如下所示: 对于节头视图,这就是xib文件的外观: 我知道它看起来很奇怪,因为标签是水平的,但我正在旋转标签,使标签的文本从下到上垂直 //Rotate the sectionHeader label [sectionHeader.headerLabel setTransform:CGAffineTransformMakeRotation(-M_PI/2)]; 现在的问题是,在更新

我有一个为iOS 7开发的餐馆菜单iPad应用程序,它使用横向滚动的
collectionView
。菜单部分标题如下所示:

对于节头视图,这就是xib文件的外观:

我知道它看起来很奇怪,因为标签是水平的,但我正在旋转标签,使标签的文本从下到上垂直

//Rotate the sectionHeader label
[sectionHeader.headerLabel setTransform:CGAffineTransformMakeRotation(-M_PI/2)];
现在的问题是,在更新到iOS9后,标签根本不显示在节标题视图中:

以下是我的节标题代码:

- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
    //UICollectionReusableView *reusableview = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeaderView" forIndexPath:indexPath];

    SectionHeader *sectionHeader = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"MyHeaderID" forIndexPath:indexPath];



    //Load the Menu Sections from the menuSections Array
    MenuSection *menuSection = [[MenuSection alloc] init];
    menuSection = [self.menuSections objectAtIndex:indexPath.section];

    //Rotate the sectionHeader label
    [sectionHeader.headerLabel setTransform:CGAffineTransformMakeRotation(-M_PI/2)];

    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"LanguageArabic"] == NO)
    {
        sectionHeader.headerLabel.text = [NSString stringWithFormat:@"%@", menuSection.sectionName];
    }
    else
    {
        sectionHeader.headerLabel.text = [NSString stringWithFormat:@"%@", menuSection.sectionNameArabic];
    }

    return sectionHeader;
}
当我注释上面的“旋转节标题”行并将xib文件中的标签固定为垂直并与节标题视图的大小相匹配时,我得到以下结果,这是一个问题,因为标签的文本应该像第一个屏幕截图一样从下到上垂直读取:

最后,我使用Todd Laney编写的一个脚本使节标题具有粘性

为什么iOS9会出现这种情况?我如何修复它?
谢谢

当您应用旋转变换时,它会围绕其中心点旋转视图。您需要做的是在xib文件中设置标签的约束,以将其垂直和水平固定到超级视图的中心。当然,你仍然要在代码中应用旋转变换。这应该可以解决问题


谢谢。这就解决了问题。这个解决方案是有道理的。尽管我仍然不知道它在iOS 7下是如何工作的。