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 thePinbutton in the lower-right corner, and configure it as follows: Click the light red brackets for the top and right, and set them each to10 Set theWidthandHeightto 44 SetUpdate FramestoItems of New Constraints

ClickAdd 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 theIdentity Inspectorand use theUser Defined Runtime Attributesto define the key path and set thecornerRadius for the button’s layer.

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 User Defined Runtime Attributes to define the key path

相关文章:

你感兴趣的文章:

标签云: