ios4 - Place UIButton randomly on the view -
thank great site, biginner in ios programming , find site immensely helpfull.
actualy have 2 questions:
1) how transform nsstring nsaray of chars?
2) how place uibutons randomly on view when each button.title shows 1 char new char array?
i programaticaly.
to transform nsstring nsaray of chars:
nsmutablearray *characters = [[nsmutablearray alloc] initwithcapacity:[mystring length]]; (int i=0; < [mystring length]; i++) { nsstring *ichar = [nsstring stringwithformat:@"%c", [mystring characteratindex:i ]]; [characters addobject:ichar]; }
2.place uibutons randomly on view when each button.title shows 1 char new char array
uibutton *charbutton = [[uibutton alloc]initwithframe:cgrect(<your required frame>)]; charbutton.titlelabel.text = [characters objectatindex:<ur required value>]; [self.view addsubview:charbutton]
Comments
Post a Comment