Translate

2015年6月11日 星期四

iphone6和6plus模拟器键盘不弹出问题

在xcode6中, 模拟器中的键盘和电脑的键盘可以进行绑定or解除绑定,打开模拟器,在最上面的菜单栏中,选择hardware,然后选择keyboards,有三个选项, 依次都勾选就行了。(注意:第三个选项在点击之后,实际已勾上了,但显示未勾上,但实际已经奏效了,这可能是xcode6的一个显示上的bug)

NSLog NSData Length to bytes

NSLog(@"File size is : %.2f MB",(CGFloat)myData.length/1024.0f/1024.0f);

Or for OS X 10.8+ and iOS 6+

NSLog(@"%@",[NSByteCountFormatter stringFromByteCount:myData.length countStyle:NSByteCountFormatterCountStyleFile]);

2015年4月14日 星期二

Xcode 6.3 not displaying memory report


I have resolved disabling Memory Guard diagnostic in the Scheme. From Xcode: Menu Product -> Scheme -> Edit Scheme... -> Diagnostic Tab -> uncheck all Guard options

If still doesn't work, try to disable (if enabled) the "Enable Zombie Object" checkbox

solve

2015年3月31日 星期二

Reachability

常常出現這個錯誤
+ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
*declaration of 'struct sockaddr_in*' will not be visible outside of this function*
看了很討厭後來再找到解決方法
解答在這
import netinet/in.h
import <>打不上去所以請自己<>

2015年3月30日 星期一

UILabel and UITextView

最近遇到一個問題
字串相同字型大小相同
在UILabel跟UITextView呈現的size不一樣
後來在這邊找到了解答


textView.textContainer.lineFragmentPadding = 0; textView.textContainerInset = UIEdgeInsetsZero; NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; paragraphStyle.lineSpacing = -0.38; NSDictionary *attrsDictionary = @{ NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:13.0f], NSParagraphStyleAttributeName: paragraphStyle}; textView.attributedText = [[NSAttributedString alloc] initWithString:textView.text attributes:attrsDictionary];