Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <UIKit/UIKit.h>
- @interface TopView : UIView {
- }
- @end
- #import "TopView.h"
- #import <QuartzCore/QuartzCore.h>
- @implementation TopView
- - (id)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- // Initialization code.
- }
- return self;
- }
- - (void)drawRect:(CGRect)rect
- {
- float borderSize = 5.0f;
- //draw the top border
- CGContextRef context = UIGraphicsGetCurrentContext();
- CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
- CGContextFillRect(context, CGRectMake(0.0f,0.0f, self.frame.size.width, borderSize));
- //draw the right border
- CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
- CGContextFillRect(context, CGRectMake(0.0f,0.0f, borderSize,self.frame.size.height));
- //draw the left border
- CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
- CGContextFillRect(context, CGRectMake(self.frame.size.width - borderSize,0.0f, borderSize,self.frame.size.height));
- }
- - (void)dealloc {
- [super dealloc];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement