// 之前设置好了frame,为了防止因为图片尺寸大于屏幕尺寸时,设置的frame失效,图片超出屏幕,需要设置self.autoresizingMask = UIViewAutoresizingNone;
- (void)awakeFromNib {
self.autoresizingMask = UIViewAutoresizingNone;
// 给图片添加监听器
self.imageView.userInteractionEnabled = YES;
[self.imageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showPicture)]];
}
网友评论