开发者

how to set forward slash line inside rect

开发者 https://www.devze.com 2023-01-17 07:09 出处:网络
i want to set forward slash line开发者_如何学编程 inside my CGRectMake. please help me out. Thanks in advance.CGRectMake only uses numbers.. so, forward slash should not be in it. If what you want to

i want to set forward slash line开发者_如何学编程 inside my CGRectMake.

please help me out. Thanks in advance.


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.


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


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();
0

精彩评论

暂无评论...
验证码 换一张
取 消