0
こんにちは私はパラメータとして文字列、int、および色を渡すことによってNSMutableAttributeStringの属性を追加するカスタムメソッドを記述するのに苦労しています、私は以下の3つのエラーを取得しています..目的の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
ありがとうございました! –