Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

BottomView

By: a guest on Aug 22nd, 2012  |  syntax: Objective C  |  size: 1.90 KB  |  views: 97  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #import <UIKit/UIKit.h>
  2. #import "TopView.h"
  3.  
  4. @interface BottomView : UIView {
  5.  
  6.         TopView *customShape;  
  7. }
  8. @property (nonatomic,retain) TopView *customShape;
  9. @end
  10.  
  11.  
  12. #import "BottomView.h"
  13. @implementation BottomView
  14. @synthesize customShape;
  15.  
  16. - (id)initWithFrame:(CGRect)frame {
  17.    
  18.     self = [super initWithFrame:frame];
  19.     if (self) {
  20.         // Initialization code.
  21.     }
  22.     return self;
  23. }
  24.  
  25. - (void)drawRect:(CGRect)rect{
  26.        
  27.         float borderSize = 5.0f;
  28.        
  29.         //draw the top left border    
  30.     CGContextRef context = UIGraphicsGetCurrentContext();
  31.     CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
  32.     CGContextFillRect(context, CGRectMake(0.0f,0.0f,((self.customShape.frame.origin.x - self.frame.origin.x) + borderSize), borderSize));
  33.  
  34.        
  35.         //draw the top right border  
  36.     CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
  37.     CGContextFillRect(context, CGRectMake((((self.customShape.frame.origin.x - self.frame.origin.x) + self.customShape.frame.size.width) - borderSize),0.0f,((self.frame.origin.x + self.frame.size.width) - (self.customShape.frame.origin.x + self.customShape.frame.size.width) ), borderSize));
  38.        
  39.          //draw the bottom border
  40.          CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
  41.          CGContextFillRect(context, CGRectMake(0.0f, self.frame.size.height - borderSize, self.frame.size.width, borderSize));
  42.        
  43.         //draw the right border
  44.     CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
  45.     CGContextFillRect(context, CGRectMake(0.0f,0.0f, borderSize,self.frame.size.height));
  46.        
  47.         //draw the left border 
  48.     CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
  49.     CGContextFillRect(context, CGRectMake(self.frame.size.width - borderSize,0.0f, borderSize,self.frame.size.height));
  50. }
  51.  
  52. - (void)dealloc {      
  53.         [customShape release];
  54.         customShape = nil;
  55.        
  56.       [super dealloc];
  57. }
  58.  
  59.  
  60. @end