iOS User Defined Runtime Attributes to define the key path

Next, add a button to the top right of each view controller. For both buttons, double-click and press backspace to set the button title to an empty string.


Also set each button’s background color to black.
Now it’s time to position the buttons with Auto Layout. Select the button on the first view controller, then select the Pin button in the lower-right corner, and configure it as follows:
Click the light red brackets for the top and right, and set them each to 10
Set the Width and Height to 44
Set Update Frames to Items of New Constraints

PinConstraints2
PinConstraints2

Click Add 4 Constraints, and the button will resize. Repeat this for the other button as well.
The last thing to configure is the shape of the buttons — you need to make them circular by setting a corner radius. Rather than painstakingly coding it, switch to the Identity Inspector and use the User Defined Runtime Attributes to define the key path and set the cornerRadius
for the button’s layer.
Screenshot 2014-10-23 12.54.26
Screenshot 2014-10-23 12.54.26

Interface Builder will not reflect the circular shape of the buttons, but build and run your app and you’ll see a black circle in the top right corner.
iOS Simulator Screen Shot Nov 3, 2014, 10.27.11 PM
iOS Simulator Screen Shot Nov 3, 2014, 10.27.11 PM

摘自:http://www.raywenderlich.com/86521/how-to-make-a-view-controller-transition-animation-like-in-the-ping-app

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容