------------------
ios7基於viewController隱藏狀態條:
通過ViewController重載方法返回枚舉值的方法來控制狀態欄的隱藏和樣式。
首先,需要在Info.plist配置文件中,增加鍵:UIViewControllerBasedStatusBarAppearance,並設置為YES;
然后,在UIViewController子類中實現以下兩個方法:
- (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleLightContent; } - (BOOL)prefersStatusBarHidden { return NO; }
最后,在需要刷新狀態欄樣式的時候,調用[self setNeedsStatusBarAppearanceUpdate]方法即可刷新
UILable奇葩的把文字draw到外面去了:
lable在ios7(bate版)下可以draw多行,只要text里有回車,如果你計算出單行text的高度並setFrame之后,對於"1\n2"這樣的文本,他的顯示就錯亂了,1跑上面去了——出了frame區域,解決方法就是setFrame之后調用:[label sizeThatFits:lable.frame.size].
UITabBarController的視圖結構變了:(這是因為kpi么)
-------
IOS7的UITableViewCell的定制沒有以前那么直接了,以前可以直接繼承UITableViewCell然后drawRect. 但是現在不行了,現在的UITableViewCell包含了一個scrollView,你重繪了UITableViewCell將會被這個scrollView遮住而完全沒法顯示.
如下是一個解決思路:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = [[[UITableViewCellalloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
UIView * subview = [[[XXView alloc] init] autorelease];
subview.userInteractionEnabled = NO;// 不設為NO會屏蔽cell的點擊事件
subview.backgroundColor = [UIColorclearColor];// 設為透明從而使得cell.backgroundColor有效.
subview.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:subview];// cell.contentView是個readonly屬性,所以別想着替換contentView了.
return cell;
}
UISearchDisplayController的delegate導致內存問題
連這個問題都有。。不得不感慨喬布斯死的早啊!
這顯示是ios7的(pre-)sdk自己的一個bug,給UISearchDisplayController設置delegate后,在UISearchDisplayController不用了的時候(比如release他之前),務必要setDelegate = nil. 否則可能會出野指針(某已釋放的對象)被調用.
self.searchDisplay.delegate = nil;