我尝试检测托架在UITextView中的新行.我可以通过比较总后来宽度和UITextView宽度来检测它:
CGSize size = [textView.text sizeWithAttributes:textView.typingAttributes];
if(size.width > textView.bounds.size.width)
NSLog (@"New line");
Run Code Online (Sandbox Code Playgroud)
但它不能正常工作,因为-sizeWithAttributes:textView只返回没有缩进宽度的字母宽度.请帮忙解决这个问题.
我试着像这样做:
let myArray: [[MyClass]] = [5,5]
Run Code Online (Sandbox Code Playgroud)
其中[5,5]是数组的大小.我不能这样做.
我有阵列:
var myArray:[(Int,Int)] = []
Run Code Online (Sandbox Code Playgroud)
但是当我通过以下方式增加价值时:
myArray.append((1,2))
Run Code Online (Sandbox Code Playgroud)
编译器显示错误警告.我的语法有什么问题?