本文实例为大家分享了ios点击文字按钮变转圈加载效果的相关代码,供大家参考,具体内容如下
实现效果:
实现代码:
// 画弧线 - (void)drawhalfcircle { loadinglayer = [self drawcircle]; // 这个是用于指定画笔的开始与结束点 loadinglayer.strokestart = 0.0; loadinglayer.strokeend = 0.75; } - (cashapelayer *)drawcircle { cgrect frame = cgrectmake(0, 0, self.frame.size.height, self.frame.size.height); cashapelayer *circlelayer = [cashapelayer layer]; // 指定frame,只是为了设置宽度和高度 circlelayer.frame = frame; // 设置居中显示 circlelayer.position = cgpointmake(self.frame.size.height/2, self.frame.size.height/2); // 设置填充颜色 circlelayer.fillcolor = [uicolor clearcolor].cgcolor; // 设置线宽 circlelayer.linewidth = 1; // 设置线的颜色 circlelayer.strokecolor = kselfbordercolor.cgcolor; // 使用uibezierpath创建路径 uibezierpath *circlepath = [uibezierpath bezierpathwithovalinrect:frame]; // 设置cashapelayer与uibezierpath关联 circlelayer.path = circlepath.cgpath; // 将cashaperlayer放到某个层上显示 [self.layer addsublayer:circlelayer]; return circlelayer; }
以上就是本文的全部内容,希望对大家的学习有所帮助。
如对本文有疑问, 点击进行留言回复!!
APP调用微信小程序,能拉起小程序,但是onResp回调不会被调用问题
Codeforces Round #657 (Div. 2) B. Dubious Cyrpto(思维,数学)
网友评论