No Round Rect Button in Xcode 5?

后端 未结 4 1993
北荒
北荒 2020-12-07 18:59

Is drag and drop of round rect button no longer available in Xcode 5? I can\'t seem to find it in the Interface Builder. I was guessing that this is one of the changes in iO

4条回答
  •  猫巷女王i
    2020-12-07 19:25

    Actually in ios 7 the total UI has been changed for basic controls. If still you want to have a rounded rect button, you have to go for the coregraphical property of UIView subclasses i.e; layer property.

    buttonObj.layer.cornerRadius = 5.0f;//any float value

    to show the effect you have to give some background color to buttonObj

    if you want to set the border width

    buttonObj.layer.borderWidth = 2.0f;//any float value

    you can also give the color for border

    buttonObj.layer.borderColor = [[UIColor greenColor]CGColor];

    Note: Here we have to use CGColor for the layers because layers are the core graphical properties of UIViews

提交回复
热议问题