Questions tagged [drawinrect]
32 questions
1
vote
0 answers
NSStringDrawingTextStorage textContainerForAttributedString:containerSize:lineFragmentPadding
Instance method of String to get height of text sizeWithFont:constrainedToSize:lineBreakMode: is deprecated for ios7. So I used boundingRectWithSize:options:context:.
But it shows this issue:
-[NSStringDrawingTextStorage…

Nilesh Tripathi
- 100
- 1
- 11
1
vote
1 answer
iOS drawInRect memory leak - ARC
I've searched all over the internet and I have found alot of people with the same issue as me and no solution...
If I have something like an NSTimer and have it loop over and over and I stick this code in it for some reason I get massive memory…

Albert Renshaw
- 17,282
- 18
- 107
- 195
0
votes
0 answers
Corrupted image in iPad simulators when scaling using drawInRect
I'm running my app in the latest Xcode 13 and images that are previously looked as expected, now corrupted when I running the app on iPad simulators.
My code is:
UIImage *myImage = [UIImage imageNamed:fileNameWithExtension];
CGRect imageRect =…

LZH
- 1
- 1
0
votes
1 answer
Error with Code 39 barcode: Gray lines showing with barcode bars when inserting inside a image
I created a blank png image and inserted some objects inside of it. like text, logo, barcode image.
Now I am getting issue with barcode image.
When I am inserting barcode-image inside of the blank png
And i opened final image I found grey lines…

Sunny Patial
- 379
- 1
- 3
- 14
0
votes
1 answer
Draw text on an image in iOS 13
I am trying to draw an image and some text on a UISlider thumbnail. I have the following code that works fine on iOS 12 and below, but does not on iOS 13 and above(specifically iOS 13.2).
- (UIImage*)getSliderImageWithImage:(UIImage*)bgImage…

humblePilgrim
- 1,818
- 4
- 25
- 47
0
votes
0 answers
draw(_ rect:CGRect) is not updating Playground Assistant editor preview
I tried different code in draw implementation. From custom UIBezierPath to simply changing background colour to random. Results are successfully updated in preview, which is shown under the line on clicking "Show Results" button. But nothing happens…

George Sabanov
- 179
- 1
- 8
0
votes
1 answer
Nsimage draw in rect but the image is blurry?
designer give me picture like this
But when I use drawInRect API draw the picture in context, the picture is like this
The size of the rect is just the size of the image.And the image is @1x and @2x.
the difference is very clear, the picture is…

melody5417
- 355
- 2
- 13
0
votes
2 answers
Unable to debug EXC BAD ACCESS Code 1
Thanks for checking out my post.
So on line image!.drawInRect(rect!), I get the EXC_BAD_ACCESS Code 1 error and I can't figure it out for the life of me. I have enabled Zombies in the Run Scheme, and nothing prints out (maybe I'm doing that wrong…

justColbs
- 1,504
- 2
- 18
- 28
0
votes
1 answer
How to delete a drawn CGPoint on a UIImageView
I have a UIImageView that i draw on it points .
I store my CGpoint in an NSArray with a capacity of 100.
Every time i receive a new CGpoint i want to erase the last object from the array , remove it from the array and then draw the new CGpoint and…

Gili Ariel
- 572
- 1
- 6
- 18
0
votes
1 answer
UIImage.DrawInRect causes error/notification
Create a simple app, and can't do it without an error
I don't really know why bg.drawInRect doesn't cause an error when player.drawInRect causing? And the problem is that image doesn't drawing/redrawing when we change coordinates
Sep 16 22:13:16…

Olexiy Pyvovarov
- 870
- 2
- 17
- 32
0
votes
2 answers
How to add UIView to custom UITableViewCell in drawRect method
In my project need to add uiview in UITableViewCell. I can add UIView using following code in UITableViewCell class.
-(void)drawRect{
[cell.contentView addSubview:myView];
}
Is this a efficient way to show when large amount of table…

Susitha
- 3,339
- 5
- 27
- 41
0
votes
1 answer
How to remove space in painting using drawinrect?
i'm using the following code to draw lines over an imageview's image,
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
if ([touch tapCount] == 2)
return;
lastPoint = [touch…
user2485029
0
votes
1 answer
iOS NSString drawInRect always drawn text below the top of RectFrame
I have a method below to draw a text (the text is "0%", font size = 30) in a RectFrame (width = 170, height = 30):
/* Draw String IOS 7 up */
-(void) drawString: (CGRect) contextRect withStr: (NSString *) string {
NSMutableParagraphStyle…

lxdyglt
- 163
- 1
- 7
0
votes
2 answers
iOS 7.1 NSString drawInRect
I have a code which worked just fine until I built my project with iOS 7.1. Before, the text correctly showed on PDF page.
[strSomeText drawInRect:rectForText withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName,…

Stanley Kubrick
- 127
- 12
0
votes
1 answer
drawInRect retains NSImage until some point in the future?
So I have some code running in an NSThread that creates, in a loop, a whole bunch of NSImages. A small section of each of the images is drawn into another NSImage, and then the thread exits.
So, something like
NSImage *outputImage = [[NSImage alloc]…

Dave Branton
- 494
- 3
- 11