-1

UITextView の感触と外観を標準化するカテゴリ クラスを作成しました。以下のコードで境界線を追加することはできますが、フォント名、フォントの色を設定する方法がわかりません。

#import "UITextView+Form.h"
#import <QuartzCore/QuartzCore.h>

@implementation UITextView (Form)

-(void)standardize{
    CALayer *thisLayer = self.layer;
    thisLayer.borderWidth=3.0;
    thisLayer.borderColor=[UIColor blackColor].CGColor;

}
@end
4

2 に答える 2

3

この方法はあなたのために働くはずです:

-(void)standardize{
    CALayer *thisLayer = self.layer;
    thisLayer.borderWidth=3.0;
    thisLayer.borderColor=[UIColor blackColor].CGColor;

    // Set whatever point size you want
    self.font = [UIFont systemFontOfSize:10.0f];    

    // Set whatever color you want
    self.textColor = [UIColor black];
}

これらも役立つはずです。

UIFont クラスのリファレンス:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIFont_Class/Reference/Reference.html

UIColor クラス リファレンス:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIColor_Class/Reference/Reference.html

于 2013-01-03T22:15:29.430 に答える
1

standardizeメソッドに次の行を追加します。

self.textColor = [UIColor ...]; // whatever color you want
self.font = [UIFont ...]; // whatever font you want
于 2013-01-03T22:14:19.547 に答える