CGAffineTransformInvert: singular matrix. 解决方案

这个错误叫奇异矩阵,

引起的原因有三种:

1  [UIFont fontWithName:@"AFontName" size:0]      你把字体的size设置为0了

2 你添加的view控件frame为0 例如:

I was seeing this problem too when I added a UIWebView to my self.view.
The offending code was:

UIWebView *wv = [[UIWebView alloc]init];
and the solution is:

UIWebView *wv = [[UIWebView alloc]initwithFrame:[[UIScreen mainScreen]bounds]];
or any framesize except 0.0.

3. UIScrollView, storyboard , autolayout 冲突,这个好像是苹果的问题,解决方法是
uncheck the "use autolayout" checkbox on storyboard properties

4.  如果你用webview 载入网页出现这样问题的话,是因为
CSS 設定 display: inline-block 而造成 Transform 错误(估计是苹果的bug)


解決方法是:
選擇一:不要用「display: inline-block」(這應該會是 Apple 會回答你的解決方案)。
選擇一:如果你跟我一樣,使用「display: inline-block」是為了要把 Element 排成橫的,那麼恭喜!你可以改用「display: table-cell」,效果一樣!



参考: 


http://stackoverflow.com/questions/7471027/overriding-layoutsubviews-causes-cgaffinetransforminvert-singular-matrix-ran
http://firchtsai.blogspot.com/2013/02/ios-cgaffinetransforminvert-singular.html

http://stackoverflow.com/questions/7471027/overriding-layoutsubviews-causes-cgaffinetransforminvert-singular-matrix-ran


down vote

I was seeing this problem too when I added a UIWebView to my self.view.

The offending code was:

UIWebView *wv = [[UIWebView alloc]init];

and the solution is:

UIWebView *wv = [[UIWebView alloc]initwithFrame:[[UIScreen mainScreen]bounds]];

or any framesize except 0.0.

你可能感兴趣的:(Objective,-c,Xcode,编程)