问题描述
|
我在UICellView的CustomCell中添加了TTStyledTextLabel,代码为:
TTStyledTextLabel * tt_title = [[[TTStyledTextLabel alloc] initWithFrame:CGRectMake(50,cell.frame.origin.y,640,200)] autorelease];
tt_title.text = [TTStyledText textWithURLs:[[self.posts objectAtIndex:indexPath.row] message]];
tt_title.font = [UIFont systemFontOfSize:15];
tt_title.contentInset = UIEdgeInsetsMake(10,10,10);
[tt_title sizetoFit];
[cell addSubview:tt_title
];
传入的Nsstring有一个URL,但是当我单击该URL时,它什么也没有做..甚至没有在Safari中打开它。.为什么呢?
解决方法
不确定是否确实看不到要传递给TTStyledText的实际字符串中的内容,但可以选择使用
[TTStyledText textFromXHTML:[[self.posts objectAtIndex:indexPath.row] message] lineBreaks:NO URLs:YES];
并在字符串中加上<a href=\'\'></a>