第一种方法:旋转字体
CGAffineTransform matrix = CGAffineTransformMake(1, 0, tanf(15 * (CGFloat)M_PI / 180), 1, 0, 0);
UIFontDescriptor *desc = [UIFontDescriptor fontDescriptorWithName:[UIFont boldSystemFontOfSize:20].fontName matrix:matrix];
UIFont *font = [UIFont fontWithDescriptor:desc size:20];
得到的font为斜体,tanf(15 * (CGFloat)M_PI / 180),倾斜15度
第二种方法:旋转控件
UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(30, 200, 300, 30)];
label.backgroundColor = [UIColor redColor];
label.text = @"forContro将label的字体设置为斜体";
CGAffineTransform matrix = CGAffineTransformMake(1, 0, tanf(-15 * (CGFloat)M_PI/ 180), 1, 0, 0);
label.transform = matrix;
[self.view addSubview:label];