_showImageView.center =
self.center;
_showImageView.size =
_showImage.size;
NSLog(@"第一种: _showImageView.frame === %@",
NSStringFromCGRect(_showImageView.frame));
_showImageView.center =
self.center;
_showImageView.bounds = (CGRect){CGPointZero,
_showImage.size};
NSLog(@"第二种: _showImageView.frame === %@",
NSStringFromCGRect(_showImageView.frame));
2014-09-23 10:41:59.311 NeiHanShe[6205:60b]
第一种: _showImageView.frame === {{160, 284}, {265, 146.13971}}
2014-09-23 10:41:59.311 NeiHanShe[6205:60b]
第二种: _showImageView.frame === {{27.5, 210.93015}, {265, 146.13971}}
所有正确设置,应该选择第二种,否则不会居中, 第一种的self.center 会当做_showImageView.frame 的 x y
时间: 2024-10-07 08:02:55