2014-10-03 2 views
0

xcode를 사용하여 화면의 임의 부분에 버튼을 표시 할 때마다 어려움을 겪고 있습니다.Im 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

+0

버튼의 속성을 만들면 – user2096064

+0

버튼의 속성을 어떻게 만들 수 있습니까? – BGandA

관련 문제