tags:

views:

45

answers:

3

i want to set forward slash line inside my CGRectMake.

please help me out. Thanks in advance.

+1  A: 

CGRectMake only uses numbers.. so, forward slash should not be in it. If what you want to do is create a forward slash within a region/rectangle, you might want to create a UILabel.

dkk
yeap....CGRectMake uses floating point...... I want to design my CGRectMake like this [ \ ].
kiran
@ thomas clayson... sorry about poor CGPoint brushSize=5;CGRect drawRect=CGRectMake(currentPoint.x-brushSize*2,currentPoint.y- brushSize*2,brushSize*4,brushSize*4);UIBezierpath *linesPath=[UIBezierPath bezierPathWithRect:drawRect];return linepath; With this i do get square shape....... now i want to change it into shape like / what to do
kiran
The rectangle shape of CGRect is just an interpretation,it is just a struct composed of a CGPoint and a CGSize. The interpretation is that CGPoint is the upper left position and CGSize is the size of the rectangle. But you could also interpret it as an Ellipse if you want. My point is that CGRect is not a shape or a visualization, this means that creating a CGRect with another shape is pointless. What you might want to do is draw a shape, or interpret the CGRect in another way. I guess the best would be if you explain your situation and why you want to convert CGRect to a forward slash.
dkk
@dkk Thanks for replaying dkk........... I am creating Brushes for iphone same as in windowsXP Paint application. where i found different brushes in windows paint app. When i select brush i found four types of brushes. first brush is circle type, i created it by using CGContext.... and for the second one square.. also same way used CGContext.... now i found forward and backward slash kind of brush i need to implement that brushes too. i am guessing it to implement through using UIBezierpath. by using UIBezierpath i can create my brush tip. then can drawn through it.
kiran
A: 

Basicllly not Possible

U May use

[myText drawAtPoint:CGPointMake(10,10) forWidth:150 withFont:font  minFontSize:10 actualFontSize:NULL lineBreakMode:UILineBreakModeCharacterWrap baselineAdjustment:UIBaselineAdjustmentAlignBaselines];

for draw "\" at 10,10

Ashish Mathur

Ashish Mathur
do i design parallelogram using UIBezierpath....if yes how?
kiran
@ Ashish mathur....... thanks the string brushes.
kiran
A: 

Use Following Code For Draw "\"

UIGraphicsBeginImageContext(self.view.frame.size);
[draw.image drawInRect:CGRectMake(0, 0, draw.frame.size.width, draw.frame.size.height)]; 
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0); // for size
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextBeginPath(UIGraphicsGetCurrentContext());
UIFont *font = [UIFont systemFontOfSize:10];
NSString *myText=[NSString stringWithFormat:@"\"];
[myText drawAtPoint:CGPointMake(j,i) forWidth:150 withFont:font  minFontSize:10 actualFontSize:NULL lineBreakMode:UILineBreakModeCharacterWrap baselineAdjustment:UIBaselineAdjustmentAlignBaselines];

CGContextStrokePath(context);
draw.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Ashish Mathur
Thanks ashish mathur........But how can i increase the length ....?
kiran
The Value Of i and j is Same For The loop.... so it goes from like (10,10) (15,15) (20,20) (25,25) (30,30)
Ashish Mathur
or you Can use loop like (10,10)(11,11)(12,12)(13,13) as per requirement Digonal
Ashish Mathur