小技巧记录

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自定义高度的时候,需要遵守UICollectionViewDelegateFlowLayout协议。实现下面的方法即可:

 - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
    if (section == 1) {
        return CGSizeMake(100, 100);
    }
    return CGSizeMake(100, 44);

}

你可能感兴趣的:(Navigation)