テクニックレコード

1446 ワード

1、navigationBarのtitleを設定する
//     
UIColor * color = [UIColor whiteColor];

NSDictionary * dict = [NSDictionary dictionaryWithObject:color forKey:UITextAttributeTextColor];

//  
self.navigationBar.titleTextAttributes = dict;

2、エラーメッセージ:class UItextView was deallocated while key value observers were still registered with it.エラー原因:kVOを使用しているため、削除通知がありません
3.UIcollectionViewを使用し、headViewの高さをカスタマイズする必要がある場合は、UIcollectionView DelegateFlowLayoutプロトコルを遵守する必要があります.次の方法を実装します.
 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
    if (section == 1) {
        return CGSizeMake(100, 100);
    }
    return CGSizeMake(100, 44);

}