验证中...
Languages: Objective-C
Categories: iOS 组件
Latest update 2019-03-27 18:57
Snippet 1 Snippet 2 Snippet 3 Snippet 4
全部代码
Raw Copy
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
#import <Foundation/Foundation.h>
@class ShoppingCarGoodsModel;
NS_ASSUME_NONNULL_BEGIN
@interface ShoppingCarModel : NSObject
@end
@interface ShoppingCarGroupModel : NSObject
//是否选中当前组(包括一个商店的全部商品)
@property(nonatomic, assign) BOOL selectGroup;
//商店名字
@property(nonatomic, copy) NSString *name;
//商店里面的商品数组
@property(nonatomic, strong) NSMutableArray<ShoppingCarGoodsModel *> *detail;
+ (NSDictionary *)mj_objectClassInArray;
@end
@interface ShoppingCarGoodsModel : NSObject
@property(nonatomic, copy) NSString *CDimage;//商品图片
@property(nonatomic, copy) NSString *CDname;//商品名
@property(nonatomic, copy) NSString *CDprice;//商品价格
@property(nonatomic, copy) NSString *CDchooseCount;//订购商品数量
//是否选中当前行(某个商店的某件商品)
@property(nonatomic, assign) BOOL selectGoods;
@end
NS_ASSUME_NONNULL_END
#import "ShoppingCarModel.h"
@implementation ShoppingCarModel
@end
@implementation ShoppingCarGroupModel
+ (NSDictionary *)mj_objectClassInArray{
return @{
@"detail":@"ShoppingCarGoodsModel"
};
}
@end
@implementation ShoppingCarGoodsModel
@end
#import <UIKit/UIKit.h>
@protocol ShoppingCarViewDelegate <NSObject>
//选中所有商品
- (void)selectAllShopGoods:(BOOL)isSelectAll;
@end
NS_ASSUME_NONNULL_BEGIN
@interface ShoppingCarView : UIView
@property(nonatomic, assign) BOOL selectAll;
@property(nonatomic, strong) UIButton *selectALLBtn;
@property(nonatomic, strong) UILabel *totalPrice;
@property(nonatomic, strong) UIButton *calculateBtn;
@property(nonatomic, weak) id<ShoppingCarViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END
#import "ShoppingCarView.h"
@implementation ShoppingCarView
- (instancetype)initWithFrame:(CGRect)frame{
if(self = [super initWithFrame:frame]){
self.selectALLBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.selectALLBtn setTitle:@"全选" forState:UIControlStateNormal];
[self.selectALLBtn setImage:[UIImage imageNamed:@"color_no_choose"] forState:UIControlStateNormal];
[self.selectALLBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
self.selectALLBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
[self.selectALLBtn addTarget:self action:@selector(selectAllGoods) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:self.selectALLBtn];
self.totalPrice = [[UILabel alloc]init];
self.totalPrice.textColor = [UIColor blackColor];
self.totalPrice.text = @"总价:";
[self addSubview:self.totalPrice];
self.calculateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.calculateBtn setTitle:@"结算" forState:UIControlStateNormal];
self.calculateBtn.backgroundColor = [UIColor orangeColor];
[self.calculateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[self addSubview:self.calculateBtn];
}
return self;
}
- (void)layoutSubviews{
[super layoutSubviews];
WeakSelf;
[self.selectALLBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.centerY.equalTo(weakSelf);
make.width.mas_equalTo(80);
}];
[self.calculateBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-10);
make.centerY.equalTo(weakSelf);
}];
[self.totalPrice mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(weakSelf);
make.left.equalTo(weakSelf.selectALLBtn.mas_right).offset(20);
}];
}
- (void)selectAllGoods{
self.selectAll = !self.selectAll;
if(self.selectAll){
[self.selectALLBtn setImage:[UIImage imageNamed:@"color_choose"] forState:UIControlStateNormal];
}else{
[self.selectALLBtn setImage:[UIImage imageNamed:@"color_no_choose"] forState:UIControlStateNormal];
}
if(self.delegate&&[self.delegate respondsToSelector:@selector(selectAllShopGoods:)]){
[self.delegate selectAllShopGoods:self.selectAll];
}
}
@end
#import <UIKit/UIKit.h>
@class ShoppingCarGroupModel;;
@protocol CustomHeaderViewDelegate <NSObject>
- (void)selectSection:(ShoppingCarGroupModel *)groupModel;
@end
NS_ASSUME_NONNULL_BEGIN
@interface CustomHeaderView : UITableViewHeaderFooterView
@property(nonatomic, strong) UIButton *sectionBtn;
@property(nonatomic, strong) UILabel *shopNameLabel;
@property(nonatomic, strong) ShoppingCarGroupModel *groupModel;
- (void)setInfo:(ShoppingCarGroupModel *)groupModel;
@property(nonatomic, weak) id<CustomHeaderViewDelegate> delegate;
@end
NS_ASSUME_NONNULL_END
#import "CustomHeaderView.h"
#import "ShoppingCarModel.h"
@interface CustomHeaderView()
{
UIView *_lineView;
}
@end
@implementation CustomHeaderView
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
if(self = [super initWithReuseIdentifier:reuseIdentifier]){
self.contentView.backgroundColor = [UIColor whiteColor];
self.sectionBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.sectionBtn setImage:[UIImage imageNamed:@"color_no_choose"] forState:UIControlStateNormal];
[self.sectionBtn addTarget:self action:@selector(selectSection) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:self.sectionBtn];
self.shopNameLabel = [[UILabel alloc]init];
self.shopNameLabel.textAlignment = NSTextAlignmentCenter;
self.shopNameLabel.textColor = [UIColor whiteColor];
self.shopNameLabel.backgroundColor = [UIColor redColor];
self.shopNameLabel.layer.cornerRadius = 3;
self.shopNameLabel.clipsToBounds = YES;
[self.contentView addSubview:self.shopNameLabel];
_lineView = [[UIView alloc]init];
_lineView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1];
[self.contentView addSubview:_lineView];
}
return self;
}
- (void)layoutSubviews{
[super layoutSubviews];
WeakSelf;
[self.sectionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.centerY.equalTo(weakSelf);
}];
[self.shopNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.sectionBtn.mas_right).offset(10);
make.centerY.equalTo(weakSelf);
}];
[_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.shopNameLabel.mas_left);
make.right.equalTo(weakSelf.contentView);
make.height.mas_equalTo(1);
make.top.mas_equalTo(39);
}];
}
- (void)setInfo:(ShoppingCarGroupModel *)groupModel{
self.groupModel = groupModel;
if(groupModel.selectGroup){
[self.sectionBtn setImage:[UIImage imageNamed:@"color_choose"] forState:UIControlStateNormal];
}else{
[self.sectionBtn setImage:[UIImage imageNamed:@"color_no_choose"] forState:UIControlStateNormal];
}
self.shopNameLabel.text = groupModel.name;
}
- (void)selectSection{
self.groupModel.selectGroup = !self.groupModel.selectGroup;
if(self.groupModel.selectGroup){
[self.sectionBtn setImage:[UIImage imageNamed:@"color_choose"] forState:UIControlStateNormal];
}else{
[self.sectionBtn setImage:[UIImage imageNamed:@"color_no_choose"] forState:UIControlStateNormal];
}
if(self.delegate&&[self.delegate respondsToSelector:@selector(selectSection:)]){
[self.delegate selectSection:self.groupModel];
}
}
@end
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface CustomFooterView : UITableViewHeaderFooterView
@end
NS_ASSUME_NONNULL_END
#import "CustomFooterView.h"
@implementation CustomFooterView
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
if(self = [super initWithReuseIdentifier:reuseIdentifier]){
self.contentView.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1];
}
return self;
}
@end
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ShoppingCarViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
#import "ShoppingCarViewController.h"
#import "ShoppingCarModel.h"
#import "ShoppingCarCell.h"
#import "ShoppingCarView.h"
#import "CustomHeaderView.h"
#import "CustomFooterView.h"
#import "UIViewController+ExtendCtr.h"
@interface ShoppingCarViewController ()<UITableViewDataSource,UITableViewDelegate,ShoppingCarViewDelegate,ShoppingCarCellDelegate,CustomHeaderViewDelegate>
@property(nonatomic, strong) dispatch_block_t deleteSelectedCell;
/** 数据源*/
@property (nonatomic, strong) NSMutableArray *dataArr;
/** 记录选中的cell*/
@property (nonatomic,strong)NSMutableArray *selectedCellArr;
@property(nonatomic, strong) UITableView *tv;
@property(nonatomic, strong) ShoppingCarView *shoppingCarBottomView;
//是否全选
@property(nonatomic, assign) BOOL selectAll;
@end
@implementation ShoppingCarViewController
-(UITableView *)tv{
if(!_tv){
_tv = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT-SafeAreaBottom_H-44) style:UITableViewStylePlain];
_tv.separatorStyle = UITableViewCellSeparatorStyleNone;
_tv.delegate = self;
_tv.dataSource = self;
_tv.sectionHeaderHeight = 40;
_tv.sectionFooterHeight = 15;
_tv.rowHeight = 100;
[_tv registerNib:[UINib nibWithNibName:@"ShoppingCarCell" bundle:nil] forCellReuseIdentifier:NSStringFromClass([ShoppingCarCell class])];
[_tv registerClass:[CustomHeaderView class] forHeaderFooterViewReuseIdentifier:NSStringFromClass([CustomHeaderView class])];
[_tv registerClass:[CustomFooterView class] forHeaderFooterViewReuseIdentifier:NSStringFromClass([CustomFooterView class])];
}
return _tv;
}
-(NSMutableArray *)dataArr{
if(_dataArr==nil){
NSString *pathStr = [[NSBundle mainBundle]pathForResource:@"ShopCarData.plist" ofType:nil];
NSArray *array = [NSMutableArray arrayWithContentsOfFile:pathStr];
NSMutableArray *mutableArr = [NSMutableArray array];
for (NSDictionary *groupDict in array) {
ShoppingCarGroupModel *groupModel = [ShoppingCarGroupModel mj_objectWithKeyValues:groupDict];
[mutableArr addObject:groupModel];
}
_dataArr = [mutableArr mutableCopy];
}
return _dataArr;
}
- (NSMutableArray *)selectedCellArr{
if(_selectedCellArr==nil){
_selectedCellArr = [NSMutableArray array];
}
return _selectedCellArr;
}
- (ShoppingCarView *)shoppingCarBottomView{
if(_shoppingCarBottomView == nil){
_shoppingCarBottomView = [[ShoppingCarView alloc]initWithFrame:CGRectMake(0, SCREENHEIGHT-SafeAreaBottom_H-44, SCREENWIDTH, 44)];
_shoppingCarBottomView.backgroundColor = [UIColor whiteColor];
_shoppingCarBottomView.delegate = self;
}
return _shoppingCarBottomView;
}
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
self.navigationItem.title = @"购物车";
[self.view addSubview:self.tv];
[self.view addSubview:self.shoppingCarBottomView];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return self.dataArr.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
ShoppingCarGroupModel *groupModel = self.dataArr[section];
return groupModel.detail.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
ShoppingCarGroupModel *groupModel = self.dataArr[indexPath.section];
ShoppingCarGoodsModel *goodsModel = groupModel.detail[indexPath.row];
ShoppingCarCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([ShoppingCarCell class])];
if(!cell){
cell = [[NSBundle mainBundle]loadNibNamed:@"ShoppingCarCell" owner:nil options:nil].firstObject;
}
cell.section = indexPath.section;
cell.row = indexPath.row;
cell.delegate = self;
[cell setInfo:goodsModel];
return cell;
}
- (void)calculatePrice{
NSInteger sum = 0;
NSInteger value = 0 ;
for (ShoppingCarGoodsModel *goodsModel in self.selectedCellArr) {
value = [goodsModel.CDprice integerValue]*[goodsModel.CDchooseCount integerValue];
sum = sum+value;
}
if(sum > 0){
self.shoppingCarBottomView.totalPrice.text = [NSString stringWithFormat:@"总价:%ld元",(long)sum];
}else{
self.shoppingCarBottomView.totalPrice.text = @"总价:";
}
}
- (void)deviseOrAddReloadDataAndTableView{
[self calculatePrice];
}
- (void)selectGoodsCell:(ShoppingCarCell *)cell{
ShoppingCarGroupModel *groupModel = self.dataArr[cell.section];
if(self.selectAll){
groupModel.selectGroup = cell.goodsModel.selectGoods;
[self.selectedCellArr removeObject:cell.goodsModel];
}else{
if(cell.goodsModel.selectGoods){
[self.selectedCellArr addObject:cell.goodsModel];
BOOL allSelected = YES;
for (ShoppingCarGoodsModel *goodsModel in groupModel.detail) {
if(!goodsModel.selectGoods){
allSelected = NO;
}
}
groupModel.selectGroup = allSelected;
}else{
groupModel.selectGroup = NO;
[self.selectedCellArr removeObject:cell.goodsModel];
}
}
[self calculatePrice];
[self.tv reloadData];
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
ShoppingCarGroupModel *groupModel = self.dataArr[section];
CustomHeaderView *headerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:NSStringFromClass([CustomHeaderView class])];
if(!headerView){
headerView = [[CustomHeaderView alloc]initWithReuseIdentifier:NSStringFromClass([CustomHeaderView class])];
}
headerView.delegate = self;
[headerView setInfo:groupModel];
//遍历每组确定是否全选 当逐条选中时,全部都选中的时候,全选选项也选中
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
BOOL allSelected = YES;
for (ShoppingCarGroupModel *groupModel in self.dataArr) {
if (!groupModel.selectGroup) {
allSelected = NO;
}
}
dispatch_async(dispatch_get_main_queue(), ^{
if(allSelected){
[self.shoppingCarBottomView.selectALLBtn setImage:[UIImage imageNamed:@"color_choose"] forState:UIControlStateNormal];
self.shoppingCarBottomView.selectAll = YES;
self.selectAll = self.shoppingCarBottomView.selectAll;
}else{
[self.shoppingCarBottomView.selectALLBtn setImage:[UIImage imageNamed:@"color_no_choose"] forState:UIControlStateNormal];
self.shoppingCarBottomView.selectAll = NO;
self.selectAll = self.shoppingCarBottomView.selectAll;
}
});
});
return headerView;
}
- (void)selectSection:(ShoppingCarGroupModel *)groupModel{
if(self.selectAll){
for (ShoppingCarGoodsModel *goodsModel in groupModel.detail) {
goodsModel.selectGoods = NO;
[self.selectedCellArr removeObject:goodsModel];
}
}else{
if(groupModel.selectGroup){
for (ShoppingCarGoodsModel *goodsModel in groupModel.detail) {
goodsModel.selectGoods = groupModel.selectGroup;
if([self.selectedCellArr containsObject:goodsModel]){
}else{
[self.selectedCellArr addObject:goodsModel];
}
}
}else{
for (ShoppingCarGoodsModel *goodsModel in groupModel.detail) {
goodsModel.selectGoods = NO;
[self.selectedCellArr removeObject:goodsModel];
}
}
}
[self calculatePrice];
[self.tv reloadData];
}
- (void)deleteGoodsCell:(ShoppingCarCell *)cell{
if(self.selectAll){
[self.dataArr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
ShoppingCarGroupModel *groupModel = (ShoppingCarGroupModel *)obj;
[groupModel.detail enumerateObjectsUsingBlock:^(ShoppingCarGoodsModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if(obj == cell.goodsModel){
[self.selectedCellArr removeObject:obj];
[groupModel.detail removeObject:obj];
if(groupModel.detail.count == 0){
[self.dataArr removeObject:groupModel];
}else{
}
}
}];
}];
if(!self.dataArr.count){
[self.shoppingCarBottomView.selectALLBtn setImage:[UIImage imageNamed:@"color_no_choose"] forState:UIControlStateNormal];
self.shoppingCarBottomView.selectALLBtn.enabled = NO;
}
}else{
[self.dataArr enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
ShoppingCarGroupModel *groupModel = (ShoppingCarGroupModel *)obj;
if(groupModel.selectGroup){
[groupModel.detail enumerateObjectsUsingBlock:^(ShoppingCarGoodsModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if(obj == cell.goodsModel){
[self.selectedCellArr removeObject:obj];
[groupModel.detail removeObject:obj];
if(groupModel.detail.count == 0){
[self.dataArr removeObject:groupModel];
}else{
}
}
}];
}else{
[groupModel.detail enumerateObjectsUsingBlock:^(ShoppingCarGoodsModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if(obj == cell.goodsModel){
if(cell.goodsModel.selectGoods){
[self.selectedCellArr removeObject:obj];
[groupModel.detail removeObject:obj];
if(groupModel.detail.count == 0){
[self.dataArr removeObject:groupModel];
}else{
}
}else{
[groupModel.detail removeObject:obj];
if(groupModel.detail.count == 0){
[self.dataArr removeObject:groupModel];
}else{
}
}
}
}];
}
}];
if(!self.dataArr.count){
[self.shoppingCarBottomView.selectALLBtn setImage:[UIImage imageNamed:@"color_no_choose"] forState:UIControlStateNormal];
self.shoppingCarBottomView.selectALLBtn.enabled = NO;
}
}
[self calculatePrice];
[self.tv reloadData];
}
- (void)selectAllShopGoods:(BOOL)isSelectAll{
self.selectAll = isSelectAll;
if(self.selectedCellArr.count){
[self.selectedCellArr removeAllObjects];
}
if(self.selectAll){
for (ShoppingCarGroupModel *groupModel in self.dataArr) {
groupModel.selectGroup = isSelectAll;
for (ShoppingCarGoodsModel *goodsModel in groupModel.detail) {
goodsModel.selectGoods = isSelectAll;
[self.selectedCellArr addObject:goodsModel];
}
}
}else{
for (ShoppingCarGroupModel *groupModel in self.dataArr) {
groupModel.selectGroup = NO;
for (ShoppingCarGoodsModel *goodsModel in groupModel.detail) {
goodsModel.selectGoods = NO;
}
}
}
[self calculatePrice];
[self.tv reloadData];
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
CustomFooterView *footerView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:NSStringFromClass([CustomFooterView class])];
if(!footerView){
footerView = [[CustomFooterView alloc]initWithReuseIdentifier:NSStringFromClass([CustomFooterView class])];
}
return footerView;
}
@end
#import <UIKit/UIKit.h>
@interface UIViewController (ExtendCtr)
/**
* 显示遮罩
*/
-(void)loadHudShowLoading;
/**
* 隐藏遮罩
*/
-(void)hiddenHud;
@end
#import "UIViewController+ExtendCtr.h"
#import "MBProgressHUD.h"
@implementation UIViewController (ExtendCtr)
-(void)loadHudShowLoading{
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:keyWindow animated:YES];
hud.tag = 100;
hud.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.4];
hud.label.text = @"删除中···";
hud.label.backgroundColor = RandomColor;
hud.bezelView.backgroundColor = RandomColor;
}
-(void)hiddenHud{
MBProgressHUD *hud = [[[UIApplication sharedApplication].delegate window] viewWithTag:100];
[hud hideAnimated:YES];
}
@end
ShopCarData.plist
Raw Copy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>name</key>
<string>李志</string>
<key>detail</key>
<array>
<dict>
<key>CDimage</key>
<string>fangao</string>
<key>CDname</key>
<string>梵高先生</string>
<key>CDprice</key>
<string>10</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
<dict>
<key>CDimage</key>
<string>nanjing</string>
<key>CDname</key>
<string>你离开了南京,从此在也没人和我说话</string>
<key>CDprice</key>
<string>20</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
<dict>
<key>CDimage</key>
<string>zhengzhou</string>
<key>CDname</key>
<string>关于郑州的记忆</string>
<key>CDprice</key>
<string>30</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>左小祖咒</string>
<key>detail</key>
<array>
<dict>
<key>CDimage</key>
<string>wulanbatuo</string>
<key>CDname</key>
<string>乌兰巴托的夜</string>
<key>CDprice</key>
<string>40</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
<dict>
<key>CDimage</key>
<string>zuoxiao</string>
<key>CDname</key>
<string>小莉</string>
<key>CDprice</key>
<string>30</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
<dict>
<key>CDimage</key>
<string>爱情的枪</string>
<key>CDname</key>
<string>爱情的枪</string>
<key>CDprice</key>
<string>50</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>adele</string>
<key>detail</key>
<array>
<dict>
<key>CDimage</key>
<string>adeleIcon</string>
<key>CDname</key>
<string>some one like you</string>
<key>CDprice</key>
<string>100</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>田馥甄</string>
<key>detail</key>
<array>
<dict>
<key>CDimage</key>
<string>mylove</string>
<key>CDname</key>
<string>My Love</string>
<key>CDprice</key>
<string>60</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
<dict>
<key>CDimage</key>
<string>banlv</string>
<key>CDname</key>
<string>灵魂伴侣</string>
<key>CDprice</key>
<string>70</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>王菲</string>
<key>detail</key>
<array>
<dict>
<key>CDimage</key>
<string>anyong</string>
<key>CDname</key>
<string>暗涌</string>
<key>CDprice</key>
<string>20</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
<dict>
<key>CDimage</key>
<string>wangfei</string>
<key>CDname</key>
<string>百年孤寂</string>
<key>CDprice</key>
<string>200</string>
<key>CDchooseCount</key>
<string>1</string>
</dict>
</array>
</dict>
</array>
</plist>
ShoppingCarCell.xib
Raw Copy
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="83" id="KGk-i7-Jjw" customClass="ShoppingCarCell">
<rect key="frame" x="0.0" y="0.0" width="515" height="220"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="515" height="219.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tOr-za-NwV">
<rect key="frame" x="10" y="99" width="19" height="22"/>
<state key="normal" image="color_no_choose"/>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="G9y-B3-Pxt">
<rect key="frame" x="44" y="65" width="90" height="90"/>
<constraints>
<constraint firstAttribute="width" constant="90" id="3WY-bK-A0l"/>
<constraint firstAttribute="height" constant="90" id="4Yt-w9-XCC"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="很大方就撒" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tDB-wz-jVd">
<rect key="frame" x="139" y="65" width="67" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="民谣" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1kF-98-qEM">
<rect key="frame" x="139" y="86" width="25" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="p0K-vo-d6N">
<rect key="frame" x="139" y="115" width="120" height="40"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="一" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xlw-ky-0fc">
<rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="BIl-qs-4S1"/>
<constraint firstAttribute="width" constant="40" id="wab-O9-gP6"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0dt-2y-NDz">
<rect key="frame" x="40" y="0.0" width="40" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="+" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nl7-Cx-5V2">
<rect key="frame" x="80" y="0.0" width="40" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<color key="textColor" red="0.93136738989637302" green="0.67349268451729805" blue="0.086800434557672293" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="0dt-2y-NDz" firstAttribute="leading" secondItem="xlw-ky-0fc" secondAttribute="trailing" id="5Mp-Fa-cpe"/>
<constraint firstItem="0dt-2y-NDz" firstAttribute="height" secondItem="xlw-ky-0fc" secondAttribute="height" id="5Ty-bT-zPs"/>
<constraint firstAttribute="height" constant="40" id="Gl5-h0-Dmn"/>
<constraint firstItem="Nl7-Cx-5V2" firstAttribute="width" secondItem="0dt-2y-NDz" secondAttribute="width" id="Ham-Tc-b5g"/>
<constraint firstItem="0dt-2y-NDz" firstAttribute="width" secondItem="xlw-ky-0fc" secondAttribute="width" id="XhS-lz-syC"/>
<constraint firstItem="Nl7-Cx-5V2" firstAttribute="height" secondItem="0dt-2y-NDz" secondAttribute="height" id="cIQ-Dn-ZQW"/>
<constraint firstItem="Nl7-Cx-5V2" firstAttribute="centerY" secondItem="0dt-2y-NDz" secondAttribute="centerY" id="cVU-uV-HDp"/>
<constraint firstItem="xlw-ky-0fc" firstAttribute="leading" secondItem="p0K-vo-d6N" secondAttribute="leading" id="jtE-Uc-gmT"/>
<constraint firstAttribute="width" constant="120" id="oAE-88-wKt"/>
<constraint firstItem="0dt-2y-NDz" firstAttribute="centerY" secondItem="xlw-ky-0fc" secondAttribute="centerY" id="rXL-Fl-60e"/>
<constraint firstItem="xlw-ky-0fc" firstAttribute="centerY" secondItem="p0K-vo-d6N" secondAttribute="centerY" id="s9D-nb-pre"/>
<constraint firstItem="Nl7-Cx-5V2" firstAttribute="leading" secondItem="0dt-2y-NDz" secondAttribute="trailing" id="tVr-r1-cd9"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="26元" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Abj-Lk-jro">
<rect key="frame" x="461" y="85" width="34" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Whl-Ux-cjm">
<rect key="frame" x="468.5" y="113" width="19" height="22"/>
<state key="normal" image="mer_x_shop"/>
<connections>
<action selector="clearGoods:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="BAH-6i-G6T"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Sb9-S2-Zjt">
<rect key="frame" x="0.0" y="218.5" width="515" height="1"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="XDM-vY-97i"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="Whl-Ux-cjm" firstAttribute="bottom" secondItem="G9y-B3-Pxt" secondAttribute="bottom" constant="-20" id="0be-oN-y4a"/>
<constraint firstItem="Sb9-S2-Zjt" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="0er-mh-vcu"/>
<constraint firstItem="tOr-za-NwV" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="1wZ-56-REs"/>
<constraint firstItem="tDB-wz-jVd" firstAttribute="leading" secondItem="G9y-B3-Pxt" secondAttribute="trailing" constant="5" id="2vc-Ed-8Bv"/>
<constraint firstItem="tOr-za-NwV" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="10" id="7fl-6D-0bg"/>
<constraint firstItem="1kF-98-qEM" firstAttribute="top" secondItem="tDB-wz-jVd" secondAttribute="bottom" constant="5" id="97S-Zx-3E7"/>
<constraint firstItem="1kF-98-qEM" firstAttribute="leading" secondItem="G9y-B3-Pxt" secondAttribute="trailing" constant="5" id="FF3-rq-0Cp"/>
<constraint firstAttribute="bottom" secondItem="Sb9-S2-Zjt" secondAttribute="bottom" id="Oft-NU-XT0"/>
<constraint firstItem="G9y-B3-Pxt" firstAttribute="leading" secondItem="tOr-za-NwV" secondAttribute="trailing" constant="15" id="UFW-fv-M3F"/>
<constraint firstItem="tDB-wz-jVd" firstAttribute="top" secondItem="G9y-B3-Pxt" secondAttribute="top" id="Wtw-FP-cNs"/>
<constraint firstItem="p0K-vo-d6N" firstAttribute="bottom" secondItem="G9y-B3-Pxt" secondAttribute="bottom" id="Wua-KD-Zgq"/>
<constraint firstItem="Whl-Ux-cjm" firstAttribute="centerX" secondItem="Abj-Lk-jro" secondAttribute="centerX" id="XjK-M5-c8Z"/>
<constraint firstAttribute="trailing" secondItem="Sb9-S2-Zjt" secondAttribute="trailing" id="bBZ-Zg-lhk"/>
<constraint firstAttribute="trailing" secondItem="Abj-Lk-jro" secondAttribute="trailing" constant="20" id="bQZ-Kb-Z5z"/>
<constraint firstItem="Abj-Lk-jro" firstAttribute="top" secondItem="G9y-B3-Pxt" secondAttribute="top" constant="20" id="ieI-Se-shG"/>
<constraint firstItem="G9y-B3-Pxt" firstAttribute="centerY" secondItem="tOr-za-NwV" secondAttribute="centerY" id="jqJ-C6-Gua"/>
<constraint firstItem="p0K-vo-d6N" firstAttribute="leading" secondItem="1kF-98-qEM" secondAttribute="leading" id="nRx-ux-zxA"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="addLabel" destination="Nl7-Cx-5V2" id="0m6-4T-38e"/>
<outlet property="clearGoods" destination="Whl-Ux-cjm" id="0DO-v5-paS"/>
<outlet property="countLabel" destination="0dt-2y-NDz" id="ZfI-jg-Ma8"/>
<outlet property="deviseLabel" destination="xlw-ky-0fc" id="bzX-mH-DLT"/>
<outlet property="goodsImage" destination="G9y-B3-Pxt" id="G8q-bP-UbX"/>
<outlet property="goodsName" destination="tDB-wz-jVd" id="eze-HW-JvD"/>
<outlet property="lineView" destination="Sb9-S2-Zjt" id="aZw-8t-PGP"/>
<outlet property="priceLabel" destination="Abj-Lk-jro" id="tP9-xJ-8x6"/>
<outlet property="selectRow" destination="tOr-za-NwV" id="xNb-Ah-ZnH"/>
</connections>
<point key="canvasLocation" x="272.80000000000001" y="24.287856071964018"/>
</tableViewCell>
</objects>
<resources>
<image name="color_no_choose" width="19" height="19"/>
<image name="mer_x_shop" width="19.5" height="18.5"/>
</resources>
</document>
color_choose@2x.png

Comment list( 0 )

You need to Sign in for post a comment

Help Search