Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我正在使用Xcode,我想让一个按钮随机出现_Xcode_Macos_Button_Uibutton - Fatal编程技术网

我正在使用Xcode,我想让一个按钮随机出现

我正在使用Xcode,我想让一个按钮随机出现,xcode,macos,button,uibutton,Xcode,Macos,Button,Uibutton,我在使用xcode使按钮在每次点击时都出现在屏幕的随机部分时遇到困难 button.center = CGPointMake(button.frame.size.width / 2.0 + arc4random_uniform(150 - button.frame.size.width), button.frame.size.height / 2.0 + arc4random_uniform(150 - button.frame.size.height))

我在使用xcode使按钮在每次点击时都出现在屏幕的随机部分时遇到困难

button.center = CGPointMake(button.frame.size.width / 2.0 + arc4random_uniform(150 -           
    button.frame.size.width), button.frame.size.height / 2.0 + arc4random_uniform(150 - 
    button.frame.size.height));
我一直在关注这些问题:

Identifier not found or '('
我想知道如何找到相框和尺寸
如果iAction方法中的“button”应该替换为“UIButton”

,请编写以下示例

button.frame=CGRectMake(button.frame.origin.x+20,button.frame.origin.y+20,button.frame.size.width,button.frame.size,height);

不移动我想移动的对象我如何制作该对象的属性button@propertynonatomic,强UIButton*myButton;然后转到xib或故事板,选择您的按钮,按control并从按钮拖动到文件所有者的透明立方体状按钮。它会自动弹出您刚刚创建的属性名称。连接到它。要确保成功构建连接,请转到声明属性的类。左边应该有一个深灰色的圆圈。