forked from liuchaogenius/DianjiaApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
401 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
YHB_Prj/YHB_Prj/Images.xcassets/sp_jia.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "1x", | ||
"filename" : "sp_jia.png" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
YHB_Prj/YHB_Prj/Images.xcassets/sp_jian.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x", | ||
"filename" : "sp_jian.png" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/YPDMTableViewCell.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// YPDMTableViewCell.h | ||
// YHB_Prj | ||
// | ||
// Created by Johnny's on 15/9/13. | ||
// Copyright (c) 2015年 striveliu. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface YPDMTableViewCell : UITableViewCell | ||
|
||
@property(nonatomic) int row; | ||
|
||
+ (CGFloat)heightForCell:(NSString *)str; | ||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier; | ||
- (void)setCellWithString:(NSString *)str andDeleteBlock:(void(^)(int))aDeleteBlock; | ||
@end |
101 changes: 101 additions & 0 deletions
101
YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/YPDMTableViewCell.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// | ||
// YPDMTableViewCell.m | ||
// YHB_Prj | ||
// | ||
// Created by Johnny's on 15/9/13. | ||
// Copyright (c) 2015年 striveliu. All rights reserved. | ||
// | ||
|
||
#import "YPDMTableViewCell.h" | ||
|
||
@interface YPDMTableViewCell() | ||
{ | ||
CGRect _laFrame; | ||
} | ||
@property(nonatomic,strong) UILabel *laMa; | ||
@property(nonatomic,strong) UIButton *btnJian; | ||
@property(nonatomic,strong) void(^ myBlock)(int); | ||
@end | ||
|
||
@implementation YPDMTableViewCell | ||
|
||
- (void)awakeFromNib { | ||
// Initialization code | ||
} | ||
|
||
+ (CGFloat)heightForCell:(NSString *)str | ||
{ | ||
NSDictionary *strAttrbute = @{NSFontAttributeName:kFont12}; | ||
CGSize strSize = [str boundingRectWithSize:CGSizeMake(kMainScreenWidth-50, 100) options:NSStringDrawingUsesLineFragmentOrigin attributes:strAttrbute context:nil].size; | ||
MLOG(@"%@", NSStringFromCGSize(strSize)); | ||
return strSize.height+12; | ||
} | ||
|
||
- (CGSize)jisuangaodu:(NSString *)str | ||
{ | ||
NSDictionary *strAttrbute = @{NSFontAttributeName:kFont12}; | ||
CGSize strSize = [str boundingRectWithSize:CGSizeMake(kMainScreenWidth-50, 100) options:NSStringDrawingUsesLineFragmentOrigin attributes:strAttrbute context:nil].size; | ||
return strSize; | ||
} | ||
|
||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier | ||
{ | ||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) | ||
{ | ||
|
||
} | ||
return self; | ||
} | ||
|
||
- (void)setCellWithString:(NSString *)str andDeleteBlock:(void (^)(int))aDeleteBlock | ||
{ | ||
[self resetCell]; | ||
|
||
_myBlock = aDeleteBlock; | ||
|
||
self.selectionStyle = UITableViewCellSelectionStyleNone; | ||
|
||
CGSize strSize = [self jisuangaodu:str]; | ||
_laMa = [[UILabel alloc] initWithFrame:CGRectMake(15, 6, strSize.width, strSize.height)]; | ||
_laMa.font = kFont12; | ||
_laMa.numberOfLines = 0; | ||
_laMa.text = str; | ||
[self addSubview:_laMa]; | ||
|
||
UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, strSize.height+12-0.7, kMainScreenWidth, 0.5)]; | ||
lineView.backgroundColor = RGBCOLOR(220, 220, 220); | ||
[self addSubview:lineView]; | ||
|
||
UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(kMainScreenWidth-30, strSize.height/2.0+6-10, 20, 20)]; | ||
[btn setImage:[UIImage imageNamed:@"sp_jian"] forState:UIControlStateNormal]; | ||
[btn addTarget:self action:@selector(touchBtn) forControlEvents:UIControlEventTouchUpInside]; | ||
[self addSubview:btn]; | ||
} | ||
|
||
- (void)resetCell | ||
{ | ||
_myBlock = nil; | ||
[self removeSubviews:self]; | ||
} | ||
|
||
- (void)touchBtn | ||
{ | ||
_myBlock(_row); | ||
} | ||
|
||
- (void)removeSubviews:(UIView *)aView | ||
{ | ||
while (aView.subviews.count) | ||
{ | ||
UIView* child = aView.subviews.lastObject; | ||
[child removeFromSuperview]; | ||
} | ||
} | ||
|
||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | ||
[super setSelected:selected animated:animated]; | ||
|
||
// Configure the view for the selected state | ||
} | ||
|
||
@end |
15 changes: 15 additions & 0 deletions
15
YHB_Prj/YHB_Prj/shangpinguanli/EditSPVC/YPDMViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// YPDMViewController.h | ||
// YHB_Prj | ||
// | ||
// Created by Johnny's on 15/9/13. | ||
// Copyright (c) 2015年 striveliu. All rights reserved. | ||
// | ||
|
||
#import "BaseViewController.h" | ||
@class SPGLProductMode; | ||
@interface YPDMViewController : BaseViewController | ||
|
||
- (instancetype)initWithProductMode:(SPGLProductMode *)aMode ; | ||
|
||
@end |
Oops, something went wrong.