gpt4 book ai didi

ios - 警告 : 'isTouchInside' in If Condition

转载 作者:行者123 更新时间:2023-11-28 20:05:10 25 4
gpt4 key购买 nike

目标:

  • 当触摸内部时,按钮背景图像发生变化

代码:

- (void)addMyButton{    // Method for creating button, with background image and other properties

UIButton *playButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
[self.view addSubview:playButton];
playButton.frame = CGRectMake(150, 150, 100, 100);
//set title,backgroundcolor...

UIImage *buttonImageNormal = [UIImage imageNamed:@"red.png"];
UIImage *strechableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:0 topCapHeight:0];
[playButton setBackgroundImage:strechableButtonImageNormal forState:UIControlStateNormal];

if([playButton isTouchInside:[UIImage buttonImageNormal]]) //This line warning
{
UIImage *buttonImageNormal2 = [UIImage imageNamed:@"yellow.png"];
UIImage *strechableButtonImageNormal2 = [buttonImageNormal2 stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[playButton setBackgroundImage:strechableButtonImageNormal2 forState:UIControlStateNormal];

}
}

请告诉我我目前在警告行中做了什么。告诉我错误是什么。并告诉我“isTouchInside”的语法。如果你愿意,请完成我的目标。

最佳答案

尝试改变:

if([playButton isTouchInside:[UIImage buttonImageNormal]])

收件人:

if([playButton isTouchInside])

isTouchInside 不接受任何参数

关于ios - 警告 : 'isTouchInside' in If Condition,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22344396/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com