Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

TopView

By: a guest on Aug 22nd, 2012  |  syntax: Objective C  |  size: 1.08 KB  |  hits: 160  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #import <UIKit/UIKit.h>
  2. @interface TopView : UIView {
  3.  
  4. }
  5. @end
  6.  
  7. #import "TopView.h"
  8. #import <QuartzCore/QuartzCore.h>
  9.  
  10. @implementation TopView
  11. - (id)initWithFrame:(CGRect)frame {
  12.    
  13.     self = [super initWithFrame:frame];
  14.  
  15.         if (self) {
  16.         // Initialization code.
  17.     }
  18.     return self;
  19. }
  20.  
  21.  
  22. - (void)drawRect:(CGRect)rect{
  23.  
  24.         float borderSize = 5.0f;
  25.        
  26.         //draw the top border    
  27.     CGContextRef context = UIGraphicsGetCurrentContext();
  28.     CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
  29.     CGContextFillRect(context, CGRectMake(0.0f,0.0f, self.frame.size.width, borderSize));
  30.  
  31.         //draw the right border
  32.     CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
  33.     CGContextFillRect(context, CGRectMake(0.0f,0.0f, borderSize,self.frame.size.height));
  34.        
  35.         //draw the left border 
  36.     CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
  37.     CGContextFillRect(context, CGRectMake(self.frame.size.width - borderSize,0.0f, borderSize,self.frame.size.height));
  38. }
  39. - (void)dealloc {
  40.     [super dealloc];
  41. }
  42. @end