Almost all of these controls can be displayed using UIWebView - if this is not an option, look at the UIWebView implementations and it should give you some idea.
However, if you want inline controls, these are probably the best options:
x by virtue of y in UILabel is easy. Just replace your indices with unicode supercode characters ... I use the following method to turn an integer into a string with superscript characters.
+(NSString *)convertIntToSuperscript:(int)i { NSArray *array = [[NSArray alloc] initWithObjects:@"โฐ", @"ยน", @"ยฒ", @"ยณ", @"โด", @"โต", @"โถ", @"โท", @"โธ", @"โน", nil]; if (i >= 0 && i <= 9) { NSString *myString = [NSString stringWithFormat:@"%@", [array objectAtIndex:i]]; [array release]; return myString; } else { NSString *base = [NSString stringWithFormat:@"%i", i]; NSMutableString *newString = [[NSMutableString alloc] init]; for (int b = 0; b<[base length]; b++) { int temp = [[base substringWithRange:NSMakeRange(b, 1)] intValue]; [newString appendString:[array objectAtIndex:temp]]; } [array release]; NSString *returnString = [NSString stringWithString:newString]; [newString release]; return returnString; } }
For a hyperlink, use a UITextView
with Property Inspector -> Detection -> Links
, and Editable
behavior is disabled. Of course, it is also available in UIWebView.
Alex coplan
source share