UIbutton 和UIview 切单角
UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.backgroundColor = [UIColor cyanColor];
btn.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:btn];
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:btn.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(10, 10)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = btn.bounds;
maskLayer.path = maskPath.CGPath;
btn.layer.mask = maskLayer;
UIButton UIView 同理。
UIbutton 和UIview 切单角的更多相关文章
- iOS:关于UIView切角的两种实现方式
转载自:http://www.jianshu.com/p/451b7fa94e2a 第一种: 我想你一见到代码,就瞬间有吐的冲动,最常用的一种方式... UIButton *button = [[UI ...
- 教你把UIView切成任意形状
有时候layer.cornerRadius并不能满足需求,自己实现drawRect又太麻烦,怎么办? 多的不说,直接上代码: - (void)dwMakeBottomRoundCornerWithRa ...
- UIView简单动画
UIView动态实现的效果有以下几种: 1.动态改变frame 2.动态改变color 3.动态改变alpha 4.动态改变bounds 首先,我们先看几种BasicView动画 #pragma ma ...
- 怎样实现UIView的旋转
首先创建界面,在viewDidLoad创建view以及button 相关代码如下 -(void)viewDidLoad { [super viewDidLoad]; viewDemo = [[UIVi ...
- 第二十篇、自定义UIButton(设置title和image的位置)
#import "CustomButton.h" #define ImageW 15 #define ImageH 15 #define KRadio 0.75 @implemen ...
- iOS - GitHub干货分享(APP引导页的高度集成 - DHGuidePageHUD - ①)
好长时间没更新博客, 是时候来一波干货分享了;APP引导页话不多说每一个APP都会用到,分量不重但是不可缺少,不论是APP的首次安装还是版本的更新,首先展现给用户眼前的也就只有它了吧,当然这里讲的不是 ...
- IOS - 常用宏定义和功能方法
可能不定期添加新的东西 github地址:https://github.com/yuqingzhude/CommonUseDemo /************************Tools**** ...
- GitHub干货分享(APP引导页的高度集成 - DHGuidePageHUD)
每一个APP都会用到APP引导页,分量不重但是不可缺少,不论是APP的首次安装还是版本的更新,首先展现给用户眼前的也就只有它了,当然这里讲的不是APP引导页的美化而是APP引导页的高度集成,一行代码搞 ...
- iOS中 Animation 动画大全 韩俊强的博客
每日更新关注:http://weibo.com/hanjunqiang 新浪微博! iOS开发者交流QQ群: 446310206 1.iOS中我们能看到的控件都是UIView的子类,比如UIButt ...
随机推荐
- MapReduce:详解Shuffle过程(转)
/** * author : 冶秀刚 * mail : dennyy99@gmail.com */ Shuffle过程是MapReduce的核心,也被称为奇迹发生的地方.要想理解MapRedu ...
- ubuntu 彻底删除卸载
1911 sudo apt-get install zabbix-agent 1916 sudo apt-get autoremove zabbix_agent root@(none):~# apt- ...
- Codeigniter CRUD代码快速构建
一个与数据库操作打交道的应用,必然涉及到数据的添加.修改.删除等操作.因此CRUD操作几乎成为每个后台管理站点的必备功能.数据库的复杂性,导致PHP操作代码也会有不少的冗余,因此,如果可以有工具自动生 ...
- phpStorm支持CodeIgniter代码提示/自动完成
下载这个文件phpstorm-ci-ac 或者去github下载解压里面的三个文件到ci根目录下然后找到这三个文件 system\core\Controller.phpsystem\core\Mode ...
- SQL 查询CET使用领悟
用到sql的遍历循环查询,如果不考虑用CET,估计又到了自己造轮子的时代了,现在觉得sql的CET确实是个好东西,针对SQL的递归查询,很是不错的方法: with etcRecommandINfo2( ...
- ajax请求node.js接口时出现 No 'Access-Control-Allow-Origin' header is present on the requested resource错误
ajax请求node.js接口出现了如下的错误: XMLHttpRequest cannot load http://xxx.xxx.xx.xx:8888/getTem?cityId=110105&a ...
- POJ2112 Optimal Milking(最大流)
先Floyd求牛到机器最短距离,然后二分枚举最长的边. #include<cstdio> #include<cstring> #include<queue> #in ...
- LightOJ1119 Pimp My Ride(状压DP)
dp[S]表示已经完成的工作集合 枚举从哪儿转移过来的,再通过枚举计算花费..水水的.. #include<cstdio> #include<cstring> #include ...
- Linux 档案与目录管理
『 cd /etc 』这个情况,这也就是所谓的『绝对路径』,他是从根目录连续写上来的一个情况,所以不论你在哪一个路径现执行这一个指令,都会将你移动到该路径下.那如果我是使用『 cd etc 』呢?那表 ...
- Codeforces Round #213 (Div. 2) B. The Fibonacci Segment
#include <iostream> #include <algorithm> #include <vector> using namespace std; in ...