2014-10-03 26 views
0

我有困難,同時使用xcode使按鈕出現在屏幕的任何部分,每次我點擊它。即時通訊使用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 '(' 

而且我想知道如何找到幀大小 如果「按鈕」應該「的UIButton」

被替換

回答

0

在IBAction方法寫這個(只是例子)

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

不移動我想要的主題mov e – BGandA 2014-10-03 14:13:56

+0

使按鈕的屬性,然後它將工作 – user2096064 2014-10-03 14:56:49

+0

我將如何使按鈕的屬性 – BGandA 2014-10-04 07:28:30

相關問題