I would like to create a tag cloud of sorts, and I thought of using a UITextView. Is it possible to have variable text sizes in a UITextView? If not, any other suggestions on which UI elements to use to generate a tag cloud?

有帮助吗?

解决方案

I would recommend programmatically adding UILabel objects as needed. You can only have one font size per UITextView, plus UITextView is generally for editable text. Just roughly, you could use something like this:

 UILabel *example = [[UILabel alloc] initWithFrame:<#(CGRect)#>];
 [example setFont:<#(UIFont *)#>];
 [example setText:<#(NSString *)#>];
 [self.view addSubview:example];

You can put it in a loop and fill in the blanks.

其他提示

It should be possible in iOS 6 (if you can wait that long) since Apple is finally adding the possibility to use NSAttributedString in UITextView.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top