我收到了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]
答案 0 :(得分:-3)
Alway尝试设置你的ImageView框架像这样: YourImageView.frame = CGRectMake(x_position,y_position,width,height);