ios 图形学习笔记
一、显示文本:
1.UIFont,用于设置显示的字体
初始化方法:fontNamesForFamilyName:(类方法)
fontWithName:size:(类方法)
2.绘制文本的方法:
NSString的drawAtPoint:withFont:
3.文本颜色UIColor:
初始化方法:colorWithRed:green:blue:alpha: (类方法)
从一个实例获得具体的某个颜色值方式如下:
UIColor *steelBlueColor = [UIColor colorWithRed:0.3f
green:0.4f
blue:0.6f
alpha:1.0f];
CGColorRef colorRef = [steelBlueColor CGColor];
const CGFloat *components = CGColorGetComponents(colorRef);
NSUInteger componentsCount = CGColorGetNumberOfComponents(colorRef);
NSUInteger counter = 0;
for (counter = 0;
counter < componentsCount;
counter++){
NSLog(@"Component %lu = %.02f",
(unsigned long)counter + 1,
components[counter]);
4.绘制图片:
imageNamed: 类方法
imageWithData:类方法
initWithContentsOfFile:实例方法(用于初始化)


浙公网安备 33010602011771号