Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top