는 내가 텍스트에 링크를 사용할 필요가 https://github.com/honcheng/RTLabel 에서 RTLabel를 사용, 내가 사용합니다. 링크에서 굵은 텍스트를 취소하는 방법?RTLabel 문제 (굵게 링크)
1
A
답변
1
나는 내 방식이 최선이 아니라고 생각하지만, 어쨌든 :
- (void)render
기능에 I 교체 (추가 linkShouldBe_regularFont 속성을
else if ([component.tagLabel caseInsensitiveCompare:@"a"] == NSOrderedSame)
{
if (self.currentSelectedButtonComponentIndex==index)
{
if (self.selectedLinkAttributes)
{
[self applyFontAttributes:self.selectedLinkAttributes toText:attrString atPosition:component.position withLength:[component.text length]];
}
else
{
[self applyBoldStyleToText:attrString atPosition:component.position withLength:[component.text length]];
[self applyColor:@"#FF0000" toText:attrString atPosition:component.position withLength:[component.text length]];
}
}
else
{
if (self.linkAttributes)
{
[self applyFontAttributes:self.linkAttributes toText:attrString atPosition:component.position withLength:[component.text length]];
}
else
{
[self applyBoldStyleToText:attrString atPosition:component.position withLength:[component.text length]];
[self applySingleUnderlineText:attrString atPosition:component.position withLength:[component.text length]];
}
}
NSString *value = [component.attributes objectForKey:@"href"];
value = [value stringByReplacingOccurrencesOfString:@"'" withString:@""];
[component.attributes setObject:value forKey:@"href"];
[links addObject:component];
}
- 내 사용자 정의 속성, linkShouldBe_regularFont == YES 경우, 글꼴) 일반 될 것입니다 :
else if ([component.tagLabel caseInsensitiveCompare:@"a"] == NSOrderedSame)
{
if (self.currentSelectedButtonComponentIndex==index)
{
if (self.selectedLinkAttributes)
{
[self applyFontAttributes:self.selectedLinkAttributes toText:attrString atPosition:component.position withLength:[component.text length]];
}
else
{
if (!self.linkShouldBe_regularFont) {
[self applyBoldStyleToText:attrString atPosition:component.position withLength:[component.text length]];
}
[self applyColor:@"#FF0000" toText:attrString atPosition:component.position withLength:[component.text length]];
}
}
else
{
if (self.linkAttributes)
{
[self applyFontAttributes:self.linkAttributes toText:attrString atPosition:component.position withLength:[component.text length]];
}
else
{
if (!self.linkShouldBe_regularFont) {
[self applyBoldStyleToText:attrString atPosition:component.position withLength:[component.text length]];
}
[self applySingleUnderlineText:attrString atPosition:component.position withLength:[component.text length]];
}
}
NSString *value = [component.attributes objectForKey:@"href"];
value = [value stringByReplacingOccurrencesOfString:@"'" withString:@""];
[component.attributes setObject:value forKey:@"href"];
[links addObject:component];
}
2
linkAttributes
속성은 링크의 사용자 정의 스타일을 사용할 수 있습니다. linkAttributes
을 빈 사전으로 설정하면 링크의 스타일이 지정되지 않습니다.
// Remove all link styles
descriptionSourceLabel.linkAttributes = @{};
// To change only i.e. link color
descriptionSourceLabel.linkAttributes = @{@"color": @"red"};
관련 문제
- 1. iphone의 글꼴 굵게 문제
- 2. Jquery와 함께 클릭하면 굵게 링크 만들기
- 3. jQuery 아코디언 HTML 링크 문제
- 4. 링크 문제
- 5. 교환/반전 순서 굵게 - 굵게 굵게 굵게 굵게 굵게 표시되지 않은 내가 교환하는 방법을 알아낼 수 없습니다
- 6. 링크 문제 DirectX : 링커 문제
- 7. 굵게 링크 된 텍스트로 텍스트 스타일링이 작동하지 않습니다.
- 8. jQuery (워드 프레스에서)를 사용하여 상위 URL에 굵게 링크
- 9. 굵게 TitledBorder의
- 10. 글꼴을 굵게,
- 11. GCC 라이브러리 링크 문제
- 12. Sifr 3 링크 문제
- 13. HTML/CSS 링크 문제
- 14. 파일 링크 문제
- 15. 장고 URL - 링크 문제
- 16. 다운로드 링크 설정 문제
- 17. 딥 링크 문제
- 18. opencv_createsamples의 링크 문제
- 19. dataDetectorTypes 전화 링크 문제
- 20. librrd 링크 문제
- 21. 선택한 페이지 링크 문제
- 22. Zendframework 링크 문제
- 23. 링크 목록 문제,
- 24. Angular2 딥 링크 문제
- 25. GCC 링크 주문 문제
- 26. 링크 된 목록 문제
- 27. Release x64의 링크 문제
- 28. libpng15 정적 링크 문제
- 29. CSS와 링크 관련 문제
- 30. 부스트 라이브러리 링크 문제
아래의 링크 속성 솔루션이 올바른 것이어야합니다. – jyek