btnClear = [[UIbutton buttonWithType:UIbuttonTypeRoundedRect] retain];btnClear.frame = CGRectMake(115,350,90,40);[btnClear setTitle:@"Clear" forState:UIControlStatenormal];btnClear.backgroundcolor = [UIcolor clearcolor];[btnClear addTarget:self action:@selector(clearaction:) forControlEvents:UIControlEventtouchUpInsIDe];[self.vIEw addSubvIEw:btnClear];
我知道如何在Interface Builder中执行此 *** 作,但我宁愿了解如何在XCode中执行此 *** 作。
琳达
解决方法 这样做:UIbutton *btnClear = [[UIbutton alloc] init];btnClear = [[UIbutton buttonWithType:UIbuttonTypeCustom] retain];btnClear.frame = CGRectMake(115,200,40);[btnClear setTitle:@"Clear" forState:UIControlStatenormal];[btnClear setBackgroundImage:[UIImage imagenamed:@"blue_button.png"] forState:UIControlStatenormal];[btnClear addTarget:self action:@selector(clearaction:) forControlEvents:UIControlEventtouchUpInsIDe];[self.vIEw addSubvIEw:btnClear];总结
以上是内存溢出为你收集整理的iphone – 为UIButton设置背景图像全部内容,希望文章能够帮你解决iphone – 为UIButton设置背景图像所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)