| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- //
- // SubmitOrderCell.m
- // IBOSSIPAD
- //
- // Created by iHope on 14-7-18.
- // Copyright (c) 2014年 elongtian. All rights reserved.
- //
- #import "SubmitOrderCell.h"
- @interface SubmitOrderCell()<UITextFieldDelegate>
- @property(strong) UIButton * btnSelect;
- //@property(copy,nonatomic) NSString *hiddenID;
- @end
- @implementation SubmitOrderCell
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
-
-
- }
- return self;
- }
- -(void)setReadOnly
- {
- _txtMarkedPrice.enabled=NO;
- _txtRemarks.enabled=NO;
- _txtSalesPrice.enabled=NO;
- _txtSalesQuantity.enabled=NO;
-
- }
- -(void)hideSelect
- {
- _btnSelect.hidden=YES;
- }
- -(void)awakeFromNib
- {
- [super awakeFromNib];
- _hiddenID=@"";
- _btnSelect=[UIButton buttonWithType:UIButtonTypeCustom];
- _btnSelect.frame=CGRectMake(10, 151, 63, 63);
-
- [_btnSelect addTarget:self action:@selector(btnGoCheck) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:_btnSelect];
-
-
-
- UIImageView *lineView = [[UIImageView alloc] initWithFrame:CGRectMake(Screen_Width-30, 151, 10, 23)];
- lineView.image = [UIImage imageNamed:@"jiantou.png"];
- [self.contentView addSubview:lineView];
-
- _lblCartID=[UILabel new];
- _lblInventoryID=[UILabel new];
- _lblCodeID=[UILabel new];
- _lblGradeID=[UILabel new];
- _lblWarehouseID=[UILabel new];
- _lblBrandID=[UILabel new];
- _lblKindID=[UILabel new];
- _lblVarietyID=[UILabel new];
- _lblSeriesID=[UILabel new];
- _lblUnitID=[UILabel new];
- _lblGradeName=[UILabel new];
-
- [_txtRemarks removeFromSuperview];
- [_txtSalesPrice removeFromSuperview];
- [_txtSalesQuantity removeFromSuperview];
- [_txtMarkedPrice removeFromSuperview];
- [self addSubview:_txtRemarks];
- [self addSubview:_txtSalesPrice];
- [self addSubview:_txtSalesQuantity];
- [self addSubview:_txtMarkedPrice];
- // [_txtRemarks addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
- // [_txtSalesPrice addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
- // [_txtSalesQuantity addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
- // [_txtMarkedPrice addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
-
- _txtSalesPrice.keyboardType=UIKeyboardTypeNumberPad;
- _txtSalesQuantity.keyboardType=UIKeyboardTypeNumberPad;
- _txtMarkedPrice.keyboardType=UIKeyboardTypeNumberPad;
- _txtSalesPrice.delegate=self;
- _txtSalesQuantity.delegate=self;
- _txtMarkedPrice.delegate=self;
- _txtRemarks.delegate=self;
- _txtSalesPrice.tag=1001;
- _txtSalesQuantity.tag=1002;
- _txtRemarks.tag=1003;
- _txtMarkedPrice.tag=1004;
- }
- - (void)textFieldDidBeginEditing:(UITextField *)textField
- {
-
- }
- - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
- {
- NSCharacterSet *cs;
- if(textField == _txtSalesQuantity)
- {
- cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERSANDDOT] invertedSet];
- NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
- BOOL basicTest = [string isEqualToString:filtered];
- if(!basicTest)
- {
-
- return NO;
- }
- }
- if(textField == _txtSalesPrice)
- {
- cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERSANDDOT] invertedSet];
- NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
- BOOL basicTest = [string isEqualToString:filtered];
- if(!basicTest)
- {
- return NO;
- }
- }
- if(textField == _txtMarkedPrice)
- {
- cs = [[NSCharacterSet characterSetWithCharactersInString:NUMBERSANDDOT] invertedSet];
- NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""];
- BOOL basicTest = [string isEqualToString:filtered];
- if(!basicTest)
- {
- return NO;
- }
- }
-
-
- //其他的类型不需要检测,直接写入
- return YES;
- }
- //编辑回調
- //- (void) textFieldDidChange:(id) sender {
- // UITextField *field = (UITextField *)sender;
- // if(field.text.length==0)return;
- //
- // else if(field.tag==1001 ||field.tag==1002||field.tag==1003||field.tag==1004){
- // if([self.delegate respondsToSelector:@selector(textValueChange: txtField:)])
- // {
- // [self.delegate textValueChange:self txtField:field];
- //
- // }
- // }
- //
- //}
- - (void) textFieldDidEndEditing:(UITextField *) field
- {
-
- if(field.tag==1001 ||field.tag==1002||field.tag==1003||field.tag==1004){
- // if([self.delegate respondsToSelector:@selector(textValueChange: txtField:)])
- // {
- // [self.delegate textValueChange:self txtField:field];
- //
- // }
- }
-
-
- }
- -(void)ParseInfoModel:(ShopCartItemModel *)model
- {
- _hiddenID=model.CartID;
- _lblCartID.text=[NSString stringWithFormat:@"%@", model.CartID ];
- _lblInventoryID.text=[NSString stringWithFormat:@"%@", model.InventoryID ];
- _txtSalesQuantity.text=[NSString stringWithFormat:@"%@", model.SalesQuantity ];
- _txtSalesPrice.text=[NSString stringWithFormat:@"%@", model.SalesPrice ];
- _txtMarkedPrice.text=[NSString stringWithFormat:@"%@", model.MarkedPrice ];
-
- _txtRemarks.text=[NSString stringWithFormat:@"%@", model.Remarks ];
- _lblSpecification.text=[NSString stringWithFormat:@"%@", model.Specification ];
-
- _lblAcreage.text=[NSString stringWithFormat:@"%@", model.Acreage ];
- _lblVolume.text=[NSString stringWithFormat:@"%@", model.Volume ];
- _lblCodeID.text=[NSString stringWithFormat:@"%@", model.CodeID ];
- _lblCode.text=[NSString stringWithFormat:@"%@", model.Code ];
- _lblOnlyCode.text=[NSString stringWithFormat:@"%@", model.OnlyCode ];
- _lblGradeID.text=[NSString stringWithFormat:@"%@", model.GradeID];
- _lblColorNumber.text=[NSString stringWithFormat:@"%@", model.ColorNumber ];
- _lblWarehouseID.text=[NSString stringWithFormat:@"%@", model.WarehouseID];
- _lblPositionNumber.text=[NSString stringWithFormat:@"%@",model.PositionNumber ];
- _lblWarehouseName.text=[NSString stringWithFormat:@"%@",model.WarehouseName ];
- _lblBalanceQuantity.text=[NSString stringWithFormat:@"%@",model.BalanceQuantity ];
- _lblBrandID.text=[NSString stringWithFormat:@"%@", model.BrandID];
- _lblBrandName.text=[NSString stringWithFormat:@"%@",model.BrandName ];
- _lblKindID.text=[NSString stringWithFormat:@"%@",model.KindID];
- _lblKindName.text=[NSString stringWithFormat:@"%@", model.KindName ];
- _lblVarietyID.text=[NSString stringWithFormat:@"%@",model.VarietyID];
- _lblVarietyName.text=[NSString stringWithFormat:@"%@", model.VarietyName ];
- _lblSeriesID.text=[NSString stringWithFormat:@"%@",model.SeriesID];
- _lblSeriesName.text=[NSString stringWithFormat:@"%@", model.SeriesName ];
- _lblUnitID.text=[NSString stringWithFormat:@"%@",model.UnitID];
- _lblUnitName.text=[NSString stringWithFormat:@"%@", model.UnitName ];
- _lblGradeName.text=[NSString stringWithFormat:@"%@",model.GradeName ];
-
-
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated
- {
- [super setSelected:selected animated:animated];
- }
- -(void)btnGoCheck
- {
- // if([self.delegate respondsToSelector:@selector(btnCheckPressed:)])
- // {
- // [self.delegate btnCheckPressed:self];
- //
- // }
- }
- - (void) setCheckBackground: (BOOL) checked
- {
- if(!checked)
- {
- _isSelect=NO;
- [_btnSelect setImage:[UIImage imageNamed:@"shenpiweixuanzhong.png"] forState:UIControlStateNormal];
- _btnSelect.imageEdgeInsets=UIEdgeInsetsMake(18,18,20,20.5);
-
- }
- else
- {
- _isSelect=YES;
- [_btnSelect setImage:[UIImage imageNamed:@"shenpixuanzhong.png"] forState:UIControlStateNormal];
- _btnSelect.imageEdgeInsets=UIEdgeInsetsMake(18,18,20,20.5);
- }
-
-
- }
- -(void) gotoDetail:(id)sender
- {
- // if([self.delegate respondsToSelector:@selector(showCartInfoDetail:)])
- // {
- // [self.delegate showCartInfoDetail:_cellIndex];
- //
- // }
- }
- @end
|