是否必须是textView?我做了一些类似的文字添加按钮,背景不可见,并添加动作来点击Safari浏览器,如下所示:
UIButton *hiperlinkButton = [UIButton buttonWithType:UIButtonTypeCustom];
[hiperlinkButton setTitle:@"your text" forState:UIControlStateNormal];
[hiperlinkButton setTitleColor:[UIColor colorWithRed:204.0/255.0 green:33.0/255.0 blue:0.0/255.0 alpha:1.0] forState:UIControlStateNormal];
[hiperlinkButton setFrame:CGRectMake(yourposition and size)];
[hiperlinkButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
[hiperlinkButton addTarget:self action:@selector(callSafari:) forControlEvents:UIControlEventTouchUpInside];
[contactsView insertSubview:hyperlinkButton aboveSubview:contactsView];
呃..什么是contactOrkut?不应该是hiperlinkbutton?为什么这甚至被标记为正确? –
是的,我忘了改名字了...... – flopes