0

我得到一个 EXC_BAD_ACCESS。我已经尝试了所有有关不良访问的建议,但没有运气。我知道这是我设置 UIImageView 框架时造成的。

这是代码...

_backImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cardback_brothers_royal"]];
CGRect imageFrame = _backImageView.frame;
imageFrame.origin.x = -9;
imageFrame.origin.y = -9;
imageFrame.size.width = 151;
imageFrame.size.height = 225;
_backImageView.frame = imageFrame;

回溯:

0   0x33cf3a22 in -[UIView(CALayerDelegate) actionForLayer:forKey:] ()
1   0x33aa201e in -[CALayer actionForKey:] ()
2   0x33aa1fce in actionForKey(CALayer*, CA::Transaction*, NSString*) ()
3   0x33aa1eba in CA::Layer::begin_change(CA::Transaction*, unsigned int, objc_object*&) ()
4   0x33a9d9e6 in CA::Layer::set_position(CA::Vec2<double> const&, bool) ()
5   0x33a9d8a2 in -[CALayer setPosition:] ()
6   0x33a9d832 in -[CALayer setFrame:] ()
7   0x33cf2aec in -[UIView(Geometry) setFrame:] ()
8   0x33cf2814 in -[UIImageView _setViewGeometry:forMetric:] ()
9   0x33cf2752 in -[UIImageView setFrame:] ()
10  0x0006cd88 in -[CardView loadBack] 
4

1 回答 1

-3

总是尝试像这样设置你的 ImageView 框架: YourImageView.frame = CGRectMake(x_position,y_position,width,height);

于 2013-04-05T02:33:49.433 回答