Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想发短信到uitextview
uitextview
别
textView.textAlignment = NSTextAlignmentCenter;
图中的解释
NSTextAlignmentCenter实际上是要走的路。只需确保视图足够宽以适合文本,或将其拉伸以填充屏幕宽度。
NSTextAlignmentCenter
如果您以编程方式创建UITextView,则需要将框架设置为.-
UITextView
textView.frame = CGRectMake(0, (SCREEN_HEIGHT - TEXT_VIEW_HEIGHT) / 2, SCREEN_WIDTH, TEXT_VIEW_HEIGHT);