- 显示的商品被封装起来,只需要修改WQShopView文件即可,其余的文件不用修改
#import <UIKit/UIKit.h>
@class WQShopData;
@interface WQShopView : UIButton
@property (nonatomic, strong) WQShopData *shopData;
@end
#import "WQShopView.h"
#import "WQShopData.h"
@interface WQShopView ()
@end
@implementation WQShopView
- (void)layoutSubviews
{
[super layoutSubviews];
[self layoutIfNeeded];
CGFloat buttonH = self.textButton.frame.size.height;
CGFloat buttonW = self.textButton.frame.size.width;
self.imageView.frame = CGRectMake(0, 0, buttonW, buttonW);
self.titleLabel.frame = CGRectMake(0, buttonW, buttonW, buttonH - buttonW);
}