Guest User

Untitled

a guest
May 28th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. - (void)loadView
  2. {
  3.  
  4. UIView *view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
  5. view.backgroundColor = [UIColor lightGrayColor];
  6. view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
  7.  
  8. int numberOfbuttons = 2;
  9. CGFloat buttonsLegth = (-20+view.bounds.size.width)/numberOfbuttons-20;
  10. for(int i=0;i<numberOfbuttons;i++){
  11. CGRect buttonFrame = CGRectMake(0, 0, buttonsLegth, 37);
  12. buttonFrame.origin.x = (buttonFrame.size.width+20)*i + 20.0;
  13. buttonFrame.origin.y = 20.0;
  14. UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; // Autoreleased
  15. button.frame = buttonFrame;
  16. [button setTitle:@"Done" forState:UIControlStateNormal];
  17. [view addSubview:button];
  18. }
  19. self.view = view;
  20. [view release];
  21. }
Add Comment
Please, Sign In to add comment