В настоящее время я нахожусь на завершающей стадии завершения приложения для сканирования штрих-кода, использующего API RedLaser. Однако есть одна проблема в том, что я не могу установить область на изображении, где он должен идентифицировать штрих-коды. Он идентифицирует штрих-код на полном изображении, а не на ActiveRegion, который я установил.
У меня нет точного кода передо мной, но это практически точная копия этого источника :
(void) setPortraitLayout
{
// Set portrait
self.parentPicker.orientation = UIImageOrientationUp;
// Set the active scanning region for portrait mode
[self.parentPicker setActiveRegion:CGRectMake(0, 100, 320, 250)];
// Animate the UI changes
CGAffineTransform transform = CGAffineTransformMakeRotation(0);
[UIView beginAnimations:@"rotateToPortrait" context:nil]; // Tell UIView we're ready to start animations.
[UIView setAnimationDelegate:self];
[UIView setAnimationCurve: UIViewAnimationCurveLinear ];
[UIView setAnimationDuration: 0.5];
redlaserLogo.transform = transform;
//A visible frame to aim with
[self setActiveRegionFrame];
[UIView commitAnimations]; // Animate!
}
(void) setActiveRegionFrame
{
//this just draws up a visible rectangle slightly smaller than supposed ActiveRegion
[_rectLayer setFrame:CGRectMake(self.parentPicker.activeRegion.origin.x - 50, self.parentPicker.activeRegion.origin.y - 50, self.parentPicker.activeRegion.size.width - 50, self.parentPicker.activeRegion.size.height - 50)];
CGPathRef path = [self newRectPathInRect:_rectLayer.bounds];
[_rectLayer setPath:path];
CGPathRelease(path);
[_rectLayer needsLayout];
}
У кого-нибудь есть опыт установки RedLaser с ручным ActiveRegion? Я использую библиотеку iPhone 3.1.0 (также пробовал с последней версией 3.2.4 на случай, если раньше была ошибка).