I created a category class which standardize the feel and look of UITextView. I manage to add border with the code below but not sure how to set font name, font color.
#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
This method should work for you:
-(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];
}
These should help too.
UIFont class reference:
UIColor class reference:
Add these lines to your standardize
method:
self.textColor = [UIColor ...]; // whatever color you want
self.font = [UIFont ...]; // whatever font you want
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.