iphone – ios5:删除UIButton边框
发布时间:2020-12-14 19:47:41 所属栏目:百科 来源:网络整理
导读:我的应用程序是放置一个带有自定义背景图像的按钮,我不需要边框. 我不知道如何删除边框. 我的代码是: UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame=CGRectMake(100,170,100,30); UIImage *cbutton = [UIImage imag
我的应用程序是放置一个带有自定义背景图像的按钮,我不需要边框.
我不知道如何删除边框. 我的代码是: UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame=CGRectMake(100,170,100,30); UIImage *cbutton = [UIImage imageNamed:@"pdficon_small.png"]; [button setImage:cbutton forState:UIControlStateNormal]; UIButton *button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button2 addTarget:self action:@selector(openWordings:) forControlEvents:UIControlEventTouchDown]; [button setTag:2]; [self.view addSubview:button]; 提前致谢. 解决方法
我假设你的意思是有一个边框arround按钮.
删除它替换行 UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 有了这个 UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 您现在正在做的是创建一个标准的RoundedRect按钮,然后将图像放在顶部.使用UIButtonTypeCustom将创建本质上是一个“空白”按钮,允许您使用您的图像. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |