1.在更新懶加載之類的插件時 會經(jīng)常遇到更新插件失效的問題,解決辦法
:(1) 打開終端,輸入defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID 獲取DVTPlugInCompatibilityUUID
? ? (2)進(jìn)入路徑 ~/Library/Application Support/Developer/Shared/Xcode/Plug-ins ,選擇失效的插件,右鍵 顯示包內(nèi)容,plist 文件中配置(1)中的獲取的UUID
感謝作者:? ?? http://www.lxweimin.com/p/92425b8e164e/comments/1053697
2.textview/textField 等輸入框的問題
(1)實時監(jiān)測輸入框文字時 ,個人多采用 通知
#define LXNotificationCenter [NSNotificationCenter defaultCenter]
[LXNotificationCenter addObserver:self selector:@selector(textDidChange:) name:UITextViewTextDidChangeNotification object:self.textView];
3. 輸入框的鍵盤處理
[LXNotificationCenter addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
觀察鍵盤frame改變的 的通知能實時監(jiān)測鍵盤切換中英文切換等等,而不用再去監(jiān)測鍵盤彈出顯示隱藏UIKeyboardWillShowNotification
UIKeyboardWillHideNotification,能較準(zhǔn)確地監(jiān)測鍵盤彈出高度
- (void)keyboardWillChangeFrame:(NSNotification *)notification
{
NSDictionary *userInfo = notification.userInfo;
// 動畫的持續(xù)時間
double duration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
// 鍵盤的frame
CGRect keyboardF = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
// 執(zhí)行動畫
[UIView animateWithDuration:duration animations:^{
// 工具條的Y值 == 鍵盤的Y值 - 工具條的高度
NSLog(@"%f",self.view.height);
NSLog(@"%f",keyboardF.origin.y);
if (keyboardF.origin.y >= self.view.height) {
self.keyboard.y = self.view.height- self.keyboard.height;
}else
{
self.keyboard.y = keyboardF.origin.y - self.keyboard.height;
}
}];
}
4.借助textfiled的 完成搜索?
之前有個需求,在Navbar上放置textfield時 ,點(diǎn)擊鍵盤return 跳轉(zhuǎn)界面時 ,會出現(xiàn)多次pop的現(xiàn)象,至今也沒太明白,看微信處理的是 點(diǎn)擊return收回了鍵盤,為了防止出現(xiàn)多次pop push,自定義個Navbar,不會出現(xiàn)多次push的效果,也不會有殘影,searchbar放置在Navbar上也會出現(xiàn)這個效果
5.加載網(wǎng)頁那些事
UILabel UItextvew UIWebview 都可以加載HTML ,
UIlabel UItextview 都是通過NSAttributedString
?加載網(wǎng)頁,
性字符串來接收html數(shù)據(jù)NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType} documentAttributes:nil error:nil];//給textView賦值的時候就得用attributedText來賦了textV.attributedText =attributedString;
webView則可以直接加載
1、直接給出url地址即可將web content載入。
NSString *path= @"http://theo2life.com";
NSURL *url= [[NSURL alloc] initWithString:path];
[self.webView loadRequest:[NSURLRequest requestWithURL:url]];
2、將本地html文件內(nèi)容嵌入webView
NSString *resourcePath= [ [NSBundle mainBundle] resourcePath];
NSString *filePath= [resourcePath stringByAppendingPathComponent:@"test.html"];
NSString *htmlstring=[[NSString alloc] initWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
[self.webView loadHTMLString:htmlstring? baseURL:[NSURL fileURLWithPath: [[NSBundle mainBundle]? bundlePath]]];
計算記載網(wǎng)頁之后的textview webView內(nèi)容高度,不同的是textview加載網(wǎng)頁之后就可以通過textview的contentofsize計算內(nèi)容高度,但是對于有圖片的網(wǎng)頁需要做圖片處理,webView在代理方法didload 方法里可以直接通過webView的scrollview的contentofsize計算內(nèi)容高度
6.IOS 字符串中去除特殊符號
http://blog.csdn.net/chenyong05314/article/details/8721380
7.ios獲取設(shè)備信息總結(jié)
http://blog.csdn.net/decajes/article/details/41807977
constraintSize.width = 300;
constraintSize.height = MAXFLOAT;
CGSize sizeFrame =[textContent sizeWithFont:textView.font constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap];
textView.frame = CGRectMake(0,0,sizeFrame.width,sizeFrame.height);
網(wǎng)上貼的代碼 還沒親測?
9. 項目中用的轉(zhuǎn)碼
http://blog.sina.com.cn/s/blog_735aa4ab01014z3y.html
10.站長工具
http://tool.chinaz.com/tools/unicode.aspx
11 在線解析及格式化驗證
http://json.cn/