tôi đã làm nó với đoạn code trên sử dụng this project
- (void)_configureTermsLabel
{
self.termsOfUseLabel.hidden = YES;
self.termsAndConditionsLabel = [[TTTAttributedLabel alloc] initWithFrame:self.termsOfUseLabel.frame];
self.termsAndConditionsLabel.font = [UIFont systemFontOfSize:14];
self.termsAndConditionsLabel.lineBreakMode = UILineBreakModeWordWrap;
self.termsAndConditionsLabel.numberOfLines = 0;
NSString *termsStr = NSLocalizedString(@"Terms of use", @"Terms of use");
NSString *privacyStr = NSLocalizedString(@"Privacy Policy", @"Privacy Policy");
NSString *andStr = NSLocalizedString(@"and", @"and");
NSString *conductStr = NSLocalizedString(@"Code of conduct", @"Code of conduct");
NSString *termsAndConditionsStr = [NSString stringWithFormat:@"%@ - %@ %@ %@", termsStr,
privacyStr, andStr, conductStr];
self.termsAndConditionsLabel.text = termsAndConditionsStr;
NSString *languageCode = [[GLQAppDelegate sharedDelegate] languageIdentifier];
NSURL *termsURL = [NSURL URLWithString:[NSString stringWithFormat:kGLQTermsOfUseURL, languageCode]];
NSURL *privacyURL = [NSURL URLWithString:[NSString stringWithFormat:kGLQPrivacyPolicyURL, languageCode]];
NSURL *conductURL = [NSURL URLWithString:[NSString stringWithFormat:kGLQCodeOfConductURL, languageCode]];
NSRange termsRange = [self.termsAndConditionsLabel.text rangeOfString:termsStr];
NSRange privacyRange = [self.termsAndConditionsLabel.text rangeOfString:privacyStr];
NSRange conductRange = [self.termsAndConditionsLabel.text rangeOfString:conductStr];
[self.termsAndConditionsLabel addLinkToURL:termsURL withRange:termsRange];
[self.termsAndConditionsLabel addLinkToURL:privacyURL withRange:privacyRange];
[self.termsAndConditionsLabel addLinkToURL:conductURL withRange:conductRange];
self.termsAndConditionsLabel.delegate = self;
self.termsAndConditionsLabel.userInteractionEnabled = YES;
[self.scrollView addSubview:self.termsAndConditionsLabel];
}
nếu nó là có thể trong bạn ứng dụng, bạn có thể sử dụng 'đối tượng UIWebView' với một định dạng 'nội dung HTML', và tất cả mọi thứ có thể nhấp chuột, và bạn sẽ có thể xử lý tất cả chúng trong ứng dụng của bạn. – holex
Vâng, tôi biết rằng giải pháp, nhưng đó là một số loại hack :) và tôi muốn có một số giải pháp thanh lịch hơn. Cảm ơn bạn! – zvjerka24
nó là rất tốn kém và giải pháp mạnh mẽ, nếu thời gian không quan trọng ... :) – holex