1.將app上傳到App Store的時候通常會遇到這個問題
很多人說這事蘋果爸爸服務器問題,重復嘗試幾次竭望,總會成功的!
但是經過嘗試發(fā)現(xiàn)如果使用Application Loader上傳成功率就非常高裕菠,所以還是推薦把ipa文件導出直接用Application Loader上傳咬清。
如果Application Loader也不行,需要檢查下自己的網絡奴潘,有時候vpn也會提高速度旧烧。
2.當tableView占不滿一屏時,去除下邊多余的單元格
self.tableView.tableHeaderView = [UIView new];
self.tableView.tableFooterView = [UIView new];
3.isKindOfClass和isMemberOfClass的區(qū)別
isKindOfClass可以判斷某個對象是否屬于某個類画髓,或者這個類的子類掘剪。
isMemberOfClass更加精準,它只能判斷這個對象類型是否為這個類(不能判斷子類)
4.__block
當一個局部變量需要在block里改變時奈虾,需要在定義時加上__block修飾夺谁,具體請看官方文檔
http://developer.apple.com/library/ios/documentation/cocoa/Conceptual/Blocks/Articles/bxVariables.html#//apple_ref/doc/uid/TP40007502-CH6-SW6
5.-[ViewController aMethod:]: unrecognized selector sent to instance 0x7fe91e607fb0
這是一個經典錯誤,ViewController不能響應aMethod這個方法肉微,錯誤原因可能viewController文件中沒有實現(xiàn)aMethod這個方法
6.UITableView (<UITableView:Ox7ff19b027000;>) failed to obtain a cell from its dataSource(<ViewController:Ox7ff19a507520>)
這個錯誤原因是tableView的代理方法-tableView:cellForRowAtIndexPath:需要返回一個UITableViewCell,而你返回了一個nil匾鸥。另外這個地方返回值不是UITableViewCell類型也會導致崩潰
7.約束如何做UIView動畫?
1碉纳、把需要改的約束Constraint拖條線出來勿负,成為屬性
2、在需要動畫的地方加入代碼村象,改變此屬性的constant屬性
3笆环、開始做UIView動畫,動畫里邊調用layoutIfNeeded方法
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *buttonTopConstraint;
self.buttonTopConstraint.constant = 100;
[UIView animateWithDuration:.5 animations:^{
[self.view layoutIfNeeded];
}];
8.從NSURL中拿到鏈接字符串
NSString *urlString = myURL.absoluteString;
9.將tableView滾動到頂部
[tableView setContentOffset:CGPointZero animated:YES];
或者
[tableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
10.如果用addTarget:action:forControlEvents:方法為一個button添加了很多點擊事件厚者,在某個時刻想一次刪除怎么辦躁劣?只需要調用下邊這句代碼
[youButton removeTarget:nil action:nil forControlEvents:UIControlEventAllEvents];
11.某個字體的高度
font.lineHeight;