Vote count:
0
I have a menu that requires me to generate dynamically.
UIImageView *menu_item = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"menu_item"]];
[menu_item setFrame:CGRectMake(0, 0, 10, 30)];
[menu addSubview:menu_item];
[menu_item setFrame:CGRectMake(10, 0, 10, 30)];
[menu addSubview:menu_item];
[menu_item setFrame:CGRectMake(20, 0, 10, 30)];
[menu addSubview:menu_item];
where menu is a UIScrollView. Only the last menu_item is shown.
I know I can re-run initWithImage to make all 3 menu items appear, but is there a quicker way to clone the UIImageView?
Note: I know looping. Don't tell me the codes can be simplified via for-loop.
asked 59 secs ago
Aucun commentaire:
Enregistrer un commentaire