0
안녕하세요, 매개 변수로 문자열, int 및 색상을 전달하여 NSMutableAttributeString에 대한 특성을 추가하는 사용자 지정 메서드를 작성하는 데 문제가 있는데, 아래에 세 가지 오류가 발생했습니다 ..객관적인 C에 추가 특성 메서드를 작성하십시오
-(NSMutableAttributedString*)setAttributedSuits: (NSString*) suitString
setwidth:(id)strokeWidth
setColor:(id)strokeColor{
NSMutableAttributedString* attributeSuits = [[NSMutableAttributedString alloc]initWithString:suitString];
if ([strokeWidth isKindOfClass:[NSString class]]&&[strokeWidth isKindOfClass:[UIColor class]]) // error 1 - use of undeclared identifier "UIColor", did you mean '_color'?
{
[attributeSuits addAttributes:@{NSStrokeWidthAttributeName:strokeWidth, // error 2 - use of undeclared identifier "NSStrokeWidthAttributeName"
NSStrokeColorAttributeName:strokeColor} //// error 3 - use of undeclared identifier "NSStrokeColorAttributeName"
range:NSMakeRange(0, suitString.length)];
}
return attributeSuits;
}
감사의 말로써 rmaddy에게 감사드립니다. 나는 프로그래밍에 매우 익숙하며 위의 코드를 개선하기위한 제안은 무엇입니까? 매우 고마워요 –
업데이트 된 답변보기 – rmaddy
모든 의견에 대단히 감사합니다 !! –