码迷,mamicode.com
首页 > 移动开发 > 详细

ios-UIKit 练习

时间:2015-09-09 21:12:25      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

没有上下文,没有渲染画图

//
//  HMView.m
//  UIKit练习
//
//  Created by YaguangZhu on 15/9/9.
//  Copyright (c) 2015年 YaguangZhu. All rights reserved.
//

#import "HMView.h"

@implementation HMView
- (void)drawRect:(CGRect)rect {
    // Drawing code
    UIImage *image = [UIImage imageNamed:@"jiangxin"];
    // 裁剪区域,外面都不显示
    UIRectClip(CGRectMake(0, 0, 100, 100));
   // [image drawAtPoint:CGPointZero];
    [image drawAsPatternInRect:rect];
}

- (void)drawText
{
    NSString *text = @"sdddfffffffffffffgrgijperwpjprthrjtjreptrhkrht";
    CGRect textFrame = CGRectMake(0, 0, 250, 250);
    NSDictionary *dict = @{NSFontAttributeName:[UIFont systemFontOfSize:20],
                           NSForegroundColorAttributeName:[UIColor redColor],
                           NSStrokeWidthAttributeName:@5
                           };
    UIRectFill(textFrame);
    //不会换行
    //[text drawAtPoint:CGPointZero withAttributes:dict];
    [text drawInRect:textFrame withAttributes:dict];
}
@end

 

ios-UIKit 练习

标签:

原文地址:http://www.cnblogs.com/zhuyaguang/p/4795844.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!