Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <UIKit/UIKit.h>
- #import "TopView.h"
- @interface BottomView : UIView {
- TopView *customShape;
- }
- @property (nonatomic,retain) TopView *customShape;
- @end
- #import "BottomView.h"
- @implementation BottomView
- @synthesize customShape;
- - (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 left border
- CGContextRef context = UIGraphicsGetCurrentContext();
- CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
- CGContextFillRect(context, CGRectMake(0.0f,0.0f,((self.customShape.frame.origin.x - self.frame.origin.x) + borderSize), borderSize));
- //draw the top right border
- CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
- 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));
- //draw the bottom border
- CGContextSetFillColorWithColor(context, [UIColor blueColor].CGColor);
- CGContextFillRect(context, CGRectMake(0.0f, self.frame.size.height - borderSize, 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 {
- [customShape release];
- customShape = nil;
- [super dealloc];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement