iOS EXC_BAD_ACCESS drawAtPoint

时间:2013-09-11 22:23:31

标签: ios uiimage exc-bad-access

当我调用drawAtPoint时偶尔会得到一个exc_bad_access。奇怪的是,它并不总是发生,通常在多次调用此方法之后。可能是什么问题?

- (UIImage *)createImage {
  NSString *testString = @"Test";
  UIFont *font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]];

  CGSize size = CGSizeMake(256, 256);

  UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);

  [testString drawAtPoint:CGPointMake(0.0, 0.0) withFont:font];
  UIImage *image = UIGraphicsGetImageFromCurrentImageContext();


  UIGraphicsEndImageContext();

  return image;
}

0 个答案:

没有答案