一些IOS開發中的小技巧

1.打包後提交報錯誤

    錯誤信息:ERROR ITMS-90035: "Invalid Signature. Code object is not signed at all. The binary at pathhtml

                  [******.app/build-libidn.sh] app

   解決方案:在Archive 界面上 選擇剛生成的那個app 右鍵 Show in Finder  顯示包含內容-》Products->Application->應用函數

                 右鍵顯示包含內容,找到文件 build-libidn.sh 刪除 從新提交就能夠了測試

2.IOS Tabbar 擋住了tableview  半行差很少 

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
    {
        self.edgesForExtendedLayout = UIRectEdgeNone;
        self.extendedLayoutIncludesOpaqueBars = NO;
        self.modalPresentationCapturesStatusBarAppearance = NO;
        self.automaticallyAdjustsScrollViewInsets = YES;
}

 3.IOS7 Tableview Group模式頂部有空白

self.tableview.tableHeaderView = [[UIView alloc]       initWithFrame:CGRectMake(0.0f, 0.0f,   self.tableview.bounds.size.width, 0.01f)];

4.Tableview 底部多餘的分割線

tableview.tableFooterView = [[UIView alloc]init];

5.CGRectInset 的意義

   這個函數接收一個CGrect,dx,和dy 返回一個CGRect 返回的CGRect 是根據傳入的CGRect和dx,dy來決定的,dx,dy 決定了放大仍是縮小傳入的CGrect的寬高,正數爲縮小,字體

   負數爲增大CGRectInset(rect,0,20) 這個是說明rect高度縮小20 可是中心點仍是和原來的CGRect 同樣。ui

6.CGRectOffset的意義

  這個函數接收一個CGrect dx,和dy 返回一個CGRect 返回的CGRect 是根據傳入的CGRect和dx,dy來決定的,dx爲正數 原CGRect總體向右偏移,負數反之,dy爲正數spa

 原CGRect總體向下偏移,負數反之, CGRectOffset (rect,0,20) 這個是說明原CGRect像下偏移20像素.net

7.CocosPod 的安裝和使用

 參考這個連接內容:http://blog.csdn.net/wzzvictory/article/details/18737437code

8.如何打包測試安裝包,給真機測試機安裝

直接在Xcode裏面build工程生成APP,打開生成app的路徑把APP拖入iTunes 便可導出測試安裝用的ipa安裝包,把ipa包給測試用戶,htm

用戶使用iTunes 同步到手機實現模擬上線後在線升級的狀況。

9.如何設置統一的導航欄背景顏色顏色

 新建一個繼承UINavigationController 的子類

 - (void)viewWillAppear:(BOOL)animated{
    [self.navigationBar setTintColor:[UIColor whiteColor]];
    [self.navigationBar setBarTintColor:[UIColor colorWithRed:151.0/255.0 green:1.0/255.0 blue:2.0/255.0 alpha:1.0]]; //IOS7  設置導航欄和狀態欄的背景顏色天貓紅
    [self.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];

}
- (UIStatusBarStyle)preferredStatusBarStyle{
  return UIStatusBarStyleLightContent;//設置狀態欄字體爲白色的
}

10.使用AFNetworking 出現報錯

   錯誤信息:Error: Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html

   解決方案:

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]
相關文章
相關標籤/搜索