作者:黑天鹅猪猪_251 | 来源:互联网 | 2023-05-21 12:43
Iamcreatingcustomkeyboardforios8.Creatingkeyboardbuttonslikethis我正在为ios8创建自定义键盘。创建这样的
I am creating custom keyboard for ios 8. Creating keyboard buttons like this
我正在为ios 8创建自定义键盘。创建这样的键盘按钮
UIButton *aBtn = [ UIButton buttonWithType:UIButtonTypeCustom ];
[aBtn setFrame:CGRectMake(x, 30, btnWidth, btnHeight)];
[aBtn setImage:[UIImage imageNamed:@"A"] forState:UIControlStateNormal];
[aBtn setTitle:@"A" forState:UIControlStateNormal];
[aBtn setTitleColor:[ UIColor blackColor] forState:UIControlStateNormal];
[aBtn setTitleColor:[ UIColor whiteColor] forState:UIControlStateHighlighted];
[aBtn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:aBtn];
My problem is that the image is not set to button. How can I solve this?
我的问题是图像没有设置为按钮。我怎么解决这个问题?
Do I need any special steps to be able to add images to Xcode for custom keyboards?
我是否需要任何特殊步骤才能将图像添加到Xcode以用于自定义键盘?
2 个解决方案