how to random placement of UIButton and value

前端 未结 8 1276
南方客
南方客 2021-01-28 22:48

i have a question view and will show 4 answers, only 1 are correct.

but i do not want the same button to be always the correct answer.

i will like to know how do

8条回答
  •  心在旅途
    2021-01-28 23:12

    You should create button and add them as subView. When you need to put button at random location, you can use:

    [button1 setFrame:CGRectMake(5,219,230,45)];
    [button2 setFrame:CGRectMake(5,273,230,45)];
    [button3 setFrame:CGRectMake(244,224,230,45)];
    [button4 setFrame:CGRectMake(244,273,230,45 )];
    

提交回复
热议问题