xcode怎么创建按钮!!我做了但是没有成功

xcode怎么创建按钮!!我做了但是没有成功,第1张

你指用 IB 还是纯代码

代码的话,创建用:

UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0,0,200,80)]]

0,0,200,80自己改合适位置。

vc 里显示用:

[self.view addSubview:button]

响应的话:

[button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside]

buttonClicked 函数记得要写。

代码方法:btn.layer.cornerRadius=5.0f

xib 选中button ->User Defined Runtime Attributes 哪里设置 key Path : “ layer.cornerRadius ” value 设置成 5.0


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11514596.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-16
下一篇2023-05-16

发表评论

登录后才能评论

评论列表(0条)

    保存