uiimageview *imageview1 = [[uiimageview alloc]initwithframe:cgrectmake(0, 200, 320, 20)];
[self.view addsubview:imageview1];
uigraphicsbeginimagecontext(imageview1.frame.size); //开始画线
[imageview1.image drawinrect:cgrectmake(0, 0, imageview1.frame.size.width, imageview1.frame.size.height)];
cgcontextsetlinecap(uigraphicsgetcurrentcontext(), kcglinecapround); //设置线条终点形状
const cgfloat lengths[] = {5,3};
cgcontextref line = uigraphicsgetcurrentcontext();
cgcontextsetstrokecolorwithcolor(line, [uicolor redcolor].cgcolor);
cgcontextsetlinedash(line, 0, lengths, 2); //画虚线
cgcontextmovetopoint(line, 0.0, 20.0); //开始画线
cgcontextaddlinetopoint(line, 310.0, 20.0);
cgcontextstrokepath(line);
imageview1.image = uigraphicsgetimagefromcurrentimagecontext();
用户登录
还没有账号?立即注册
用户注册
投稿取消
| 文章分类: |
|
还能输入300字
上传中....
雏-