简单绘图

来源:互联网 发布:股票盯盘系统公式 源码 编辑:程序博客网 时间:2024/05/22 13:21
- (void)drawRect:(CGRect)rect {    CGContextRef context=UIGraphicsGetCurrentContext();    CGContextSetLineWidth(context,0.2);    CGContextBeginPath(context);    CGContextMoveToPoint(context, 5, 50);    CGContextAddLineToPoint(context,self.frame.size.width-5, 50);    CGContextClosePath(context);    [[UIColor grayColor] setStroke];    CGContextStrokePath(context);}

再看效果

就这样,一个简单的登录界面就完成了 

总结: 

1.这个登录界面用到的东西不是很多,主要也就是主要在设计这一块。
2.最后用到了绘图的方法。主要步骤分为以下几点: 

```
//获取绘图上下文
CGContextRef context=UIGraphicsGetCurrentContext(); 

//设置粗细CGContextSetLineWidth(context,0.2);//开始绘图CGContextBeginPath(context);//移动到开始绘图点CGContextMoveToPoint(context, 5, 50);//移动到第二个点CGContextAddLineToPoint(context,self.frame.size.width-5, 50);//关闭路径CGContextClosePath(context);//设置颜色[[UIColor grayColor] setStroke];//绘图CGContextStrokePath(context);

0 0
原创粉丝点击