Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. -(void) addFirstRowOfAlphaButtons
  2. {
  3. CGFloat leftAndRightMargin = 6;
  4. double totalWidthOfMargins = 108;
  5. CGFloat marginBetweenButtons = totalWidthOfMargins/9;
  6. double usableWidthSpaceForButtons = self.view.bounds.size.width - totalWidthOfMargins;
  7. CGFloat buttonWidth = usableWidthSpaceForButtons/10;
  8. CGFloat buttonHeight = 76;
  9. CGFloat distanceFromTopToRow1 = 22;
  10.  
  11. UIButton *testButton1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
  12. testButton1.frame = CGRectMake(leftAndRightMargin, distanceFromTopToRow1, buttonWidth, buttonHeight);
  13. testButton1.layer.masksToBounds = YES;
  14. testButton1.layer.cornerRadius = 7.0;
  15. testButton1.backgroundColor = [UIColor redColor];
  16.  
  17. UIButton *testButton2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
  18. testButton2.frame = CGRectMake(leftAndRightMargin+buttonWidth+marginBetweenButtons, distanceFromTopToRow1, buttonWidth, buttonHeight);
  19. testButton2.layer.masksToBounds = YES;
  20. testButton2.layer.cornerRadius = 7.0;
  21. testButton2.backgroundColor = [UIColor blueColor];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement