Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 UITextView 有一个文字说 www.foo.com
当用户单击它时,我想访问 www.foo.com/bar/cow/index.html 而不是 UITextView 的 text 属性中显示的内容
最简单的方法是什么?
让你的班级遵守UITextViewDelegate协议。然后- (void)textViewDidBeginEditing:(UITextView *)textView以类似的方式实现:
UITextViewDelegate
- (void)textViewDidBeginEditing:(UITextView *)textView
- (void)textViewDidBeginEditing:(UITextView *)textView{ NSString *url = [NSString stringWithFormat:@"%@<additionalTextHere>", textView.text]; //do whetever with url }