澎湃iPad上线版本

topciCoverView.m 2.4KB

    // // topciCoverView.m // ThePaperBase // // Created by liyuan on 15/10/22. // Copyright (c) 2015年 scar1900. All rights reserved. // #import "topciCoverView.h" #import "AsyncImageView.h" @interface topciCoverView() @property(nonatomic, strong)UIButton *gotoBtn; @property(nonatomic ,strong)AsyncImageView *topicImg; @end @implementation topciCoverView @synthesize listBo = _listBo; -(instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { [self addSubview:self.topicImg]; [self addSubview:self.gotoBtn]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarOrientationChange:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; } return self; } -(AsyncImageView *)topicImg{ if (!_topicImg) { _topicImg = [[AsyncImageView alloc] initWithFrame:CGRectZero]; _topicImg.isHaveWaterPrint = YES; _topicImg.clipsToBounds = YES; } return _topicImg; } -(UIButton *)gotoBtn{ if (!_gotoBtn) { _gotoBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _gotoBtn.backgroundColor = [UIColor clearColor]; [_gotoBtn addTarget:self action:@selector(gotoSelector:) forControlEvents:UIControlEventTouchUpInside]; } return _gotoBtn; } -(void) gotoSelector:(UIButton *)btn{ if ([self.delegate respondsToSelector:@selector(gotoTopicContent:)]) { [self.delegate gotoTopicContent:self.listBo]; } } -(void)setListBo:(listContObjectVO *)contentBo{ _listBo = contentBo; // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ self.topicImg.imageUrl = _listBo.pic; [self setLayout]; // });? } -(void)setLayout{ // self.topicImg.frame = CGRectMake(10, 0, 512/2, 216/2); // UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; // if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) { // self.backView.frame = CGRectMake(0, 0,682/2,286/2); // }else{ // self.backView.frame = CGRectMake(0, 0,512/2,216/2); // } self.topicImg.frame = CGRectMake(0, 0,CGRectGetWidth(self.bounds)-1,CGRectGetHeight(self.bounds)); self.gotoBtn.frame = self.bounds; // self.topicImg.frame = CGRectMake(0, 0,CGRectGetWidth(self.backView.frame)-1, CGRectGetHeight(self.backView.frame)); } @end