在做登录注册的时候往往需要设置TextField的leftView,如果直接添加一个UIImageView到leftView,textField的光标就会紧挨着图片导致界面不是太美观,解决这个问题的方法非常简单,只需要把UIImageView添加到一个UIView里设置好位置,再把UIView放到textField的leftView里就好了
设置圆角使用self.layer.cornerRadius
当该视图有子视图时并且子视图遮挡住俯视图被设置为圆角的部分时需要加一句self.layer.masksToBounds = YES,因为子视图会覆盖俯视图所以就看不到圆角效果了
该句话决定子layer是否被当前layer的边界剪切。
没有使用self.layer.masksToBounds=YES 蓝色视图遮盖住红色视图的左上角所以显示的不是圆角
使用self.layer.masksToBounds=YES,设置圆角效果也可以作用于子视图,但是这样的话会造成离屏渲染,如果一个界面需要用到大量的圆角尽量不用这个方法
login's Introduction
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.