Krypt

Untitled

May 28th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -(void) makeDividerPanel: (BOOL) isPortrait
  2. {
  3.     for (UIView *view in dividerPanel.subviews)
  4.     {
  5.         [view removeFromSuperview];
  6.     }
  7.    
  8.     int leftShift = 0;
  9.    
  10.     [dividerPanel setFrame:CGRectMake(0, 0, upperPanel.frame.size.width, upperPanel.frame.size.height)];
  11.    
  12.     UIImage *dividerImage = [UIImage imageNamed:@"buttons-divider.png"];
  13.  
  14.     int btnCount = 0;
  15.     UIView *divider = [[UIView alloc] initWithFrame:CGRectMake(leftShift + [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] - 1, 0, 2, toolBarHeight)];
  16.     [divider setBackgroundColor:[UIColor colorWithPatternImage:dividerImage]];
  17.     [dividerPanel addSubview:divider];
  18.     [divider release];
  19.    
  20.     leftShift += [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] + 1;
  21.     btnCount++;
  22.     divider = [[UIView alloc] initWithFrame:CGRectMake(leftShift + [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] - 1, 0, 2, toolBarHeight)];
  23.     [divider setBackgroundColor:[UIColor colorWithPatternImage:dividerImage]];
  24.     [dividerPanel addSubview:divider];
  25.     [divider release];
  26.    
  27.     leftShift += [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] + 1;
  28.     btnCount++;
  29.     divider = [[UIView alloc] initWithFrame:CGRectMake(leftShift + [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] - 1, 0, 2, toolBarHeight)];
  30.     [divider setBackgroundColor:[UIColor colorWithPatternImage:dividerImage]];
  31.     [dividerPanel addSubview:divider];
  32.     [divider release];
  33.    
  34.     leftShift += [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] + 1;
  35.     btnCount++;
  36.     divider = [[UIView alloc] initWithFrame:CGRectMake(leftShift + [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] - 1, 0, 2, toolBarHeight)];
  37.     [divider setBackgroundColor:[UIColor colorWithPatternImage:dividerImage]];
  38.     [dividerPanel addSubview:divider];
  39.     [divider release];
  40.    
  41.     if (hasChords)
  42.     {
  43.         leftShift += [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] + 1;
  44.         btnCount++;
  45.         divider = [[UIView alloc] initWithFrame:CGRectMake(leftShift + [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] - 1, 0, 2, toolBarHeight)];
  46.         [divider setBackgroundColor:[UIColor colorWithPatternImage:dividerImage]];
  47.         [dividerPanel addSubview:divider];
  48.         [divider release];
  49.     }
  50.    
  51.     leftShift += [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] + 1;
  52.     btnCount++;
  53.     divider = [[UIView alloc] initWithFrame:CGRectMake(leftShift + [self widthForButtonWithNumber:btnCount andOrientation:isPortrait] - 1, 0, 2, toolBarHeight)];
  54.     [divider setBackgroundColor:[UIColor colorWithPatternImage:dividerImage]];
  55.     [dividerPanel addSubview:divider];
  56.     [divider release];
  57. }
Advertisement
Add Comment
Please, Sign In to add comment