1:tabBarController跳轉到另外一個一級頁面ios
當咱們用tabBarController時,若已經到其中一個TabBar的子頁,又要跳轉到某一個一級的頁面時,能夠這樣寫git
//這樣就能夠避免跳回來時又定位到子頁過去 致使底部會有空白 [self.navigationController popToRootViewControllerAnimated:NO]; ((AppDelegate *)AppDelegateInstance).tabBarController.selectedIndex = 2;
2:podfile配置文件一些知識:github
a:經常使用的版本管理 >= version 要求版本大於或者等於version,當有新版本時,都會更新至最新版本 < version 要求版本小於version,當超過version版本後,都不會再更新 <= version 要求版本小於或者等於version,當超過version版本後,都不會再更新 ~> version 好比上面說明的version=1.1.0時,範圍在[1.1.0, 2.0.0)。注意2.0.0是開區間,也就是不包括2.0.0。 b:使用本地庫 pod 'AFNetworking', :path => '~/Documents/AFNetworking’ c:經過倉庫引入 使用倉庫的master(主幹):pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git' 而是使用指定的分支: pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :branch => ‘dev' 使用指定的tag pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :tag => ‘0.7.0' 使用指定的提交版本: pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit =>’082f8319af'
3:UIWebView獲取Html的標題給APPweb
- (void)webViewDidFinishLoad:(UIWebView *)webView { titleLabel.text = [webView stringByEvaluatingJavaScriptFromString:@"document.title"]; }
4:富文本計算它的高度app
//文字 UILabel *dataLabel = [[UILabel alloc] init]; dataLabel.backgroundColor = [UIColor orangeColor]; dataLabel.text = @"我是文字文字文字文字文字文字文字文字文字文字文字11111111111111111111111111111111111"; dataLabel.textColor = [UIColor redColor]; dataLabel.font = [UIFont fontWithName:@"Arial" size:14]; dataLabel.numberOfLines = 0; [self.view addSubview:dataLabel]; //富文本設置文字行間距 NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init]; paragraphStyle.lineSpacing = 4; NSDictionary *attributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:14], NSParagraphStyleAttributeName:paragraphStyle}; dataLabel.attributedText = [[NSAttributedString alloc]initWithString:dataLabel.text attributes:attributes]; //獲取設置文本間距之後的高度 CGRect fram = [dataLabel.attributedText boundingRectWithSize:CGSizeMake(210, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin context:nil]; dataLabel.frame=CGRectMake(50, 100, 210, fram.size.height);
5:IQKeyboardManager 使用小結框架
1)支持設備方向。 2)啓用/禁用鍵盤消息時,須要設置 enable 的布爾值。 3)簡單的集成。 4)做爲一個textField/textView的AutoHandle UIToolbar須要設置 enableAutoToolbar 的布爾值。 5)能夠由父視圖AutoHandle UIToolbar或textField/textView,使用toolbarManageBehaviour枚舉。 6)方便地添加上下和完成按鈕鍵盤UIToolbar UIView類,自動使用enableAutoToolbar布爾值。 7)啓用/禁用,下/上一個按鈕類的方法,自動使用enableAutoToolbar布爾值。 8)鍵盤設置距離文本框使用keyboardDistanceFromTextField。 9)鍵盤觸摸外面用shouldResignOnTouchOutside. 禁用。 10)管理的框架時,UITextView高度太大,使用canAdjustTextView 設置適合屏幕。 11)適用在UITableView/UIScrollView 中的UITextField/UITextView 12)能夠輸入聲音在點擊「下/上一頁/完成」時。 a:能夠在AppDelegate裏面進行統一設計(這邊把它全局關掉) IQKeyboardManager *manager = [IQKeyboardManager sharedManager]; manager.enable = NO; manager.shouldResignOnTouchOutside = YES; manager.shouldToolbarUsesTextFieldTintColor = YES; manager.enableAutoToolbar = NO; b:爲某一個ViewController禁用IQKeyboardManager(若是要啓用就相反操做) #import 「IQKeyboardManager.h" @implementationExampleViewController { BOOL _wasKeyboardManagerEnabled; } -(void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; _wasKeyboardManagerEnabled = [[IQKeyboardManager sharedManager] isEnabled]; [[IQKeyboardManager sharedManager] setEnable:NO]; } -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [[IQKeyboardManager sharedManager] setEnable:_wasKeyboardManagerEnabled]; } @end c:鍵盤的回車鍵處理 1)建立一個實例變量實例化IQKeyboardReturnKeyHandler 在 ViewController 的 viewDidLoad 中 @implementationViewController { IQKeyboardReturnKeyHandler *returnKeyHandler; } - (void)viewDidLoad { [super viewDidLoad]; returnKeyHandler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self]; } 改變鍵盤上的返回鍵。 設置實例變量爲零的dealloc方法 -(void)dealloc { returnKeyHandler = nil; } d:UIToolbar(IQToolbar) 1)若是你不想添加一個特定的自動工具欄在鍵盤上方,應該添加一個類做爲它的工具欄 textField.inputAccessoryView = [[UIView alloc] init];
6:出現狀態欄重複問題ide
檢查工程中是否有引入的UIViewController+ScrollingStatusBar.h 會致使上拉時,狀態欄出現多個;
7:ios app編譯報User interaction is not allowed錯誤的解決辦法工具
ios app的編譯最關鍵的就是證書及密鑰,可是有不少時候就算你更新了證書密鑰,依舊是編譯報User interaction is not allowed錯誤。解決辦法就是把證書的訪問控制改成「容許因此應用程序訪問此項目」post
解決辦法:lua