| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580 |
- //
- // NewDeliveryRequirementCell.m
- // IBOSSHSH
- //
- // Created by ssl on 2018/1/15.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "NewDispatchRequirementCell.h"
- #import "OrderQuantity.h"
- #import "UIColor+hexColor.h"
- #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
- #define kTitleFont [UIFont systemFontOfSize:15]
- @implementation NewDispatchRequirementCell
- #pragma mark - 公共函数
- /**
- 初始化单元格
- @param style <#style description#>
- @param reuseIdentifier <#reuseIdentifier description#>
- @return <#return value description#>
- */
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
-
-
- }
- return self;
- }
- /**
- 单元格选中事件
- @param selected <#selected description#>
- @param animated <#animated description#>
- */
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- }
- #pragma mark - 委托函数
- /**
- 限制用户输入小数点后位数的方法
- @param textField <#textField description#>
- @param range <#range description#>
- @param string <#string description#>
- @return <#return value description#>
- */
- - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
- if([textField isEqual:self.remark]){
- return YES;
- }
- if ([textField.text rangeOfString:@"."].location == NSNotFound) {
- _isHaveDian = NO;
- }
- if ([string length] > 0) {
- unichar single = [string characterAtIndex:0];//当前输入的字符
- if ((single >= '0' && single <= '9') || single == '.') {//数据格式正确
- //首字母不能为0和小数点
- if([textField.text length] == 0){
- if(single == '.') {
- [self showAlertViewText:@"第一个数字不能为小数点"];
- [textField.text stringByReplacingCharactersInRange:range withString:@""];
- return NO;
- }
- }
- if([textField.text length] == 1 && [[textField.text substringToIndex:1] isEqualToString: @"0"]){
- if(!(single == '.')) {
- [textField.text stringByReplacingCharactersInRange:range withString:@""];
- return NO;
- }
- }
- //输入的字符是否是小数点
- if (single == '.') {
- if(!_isHaveDian)//text中还没有小数点
- {
- _isHaveDian = YES;
- return YES;
- }else{
- [self showAlertViewText:@"您已经输入过小数点了"];
- [textField.text stringByReplacingCharactersInRange:range withString:@""];
- return NO;
- }
- }else{
- if (_isHaveDian) {//存在小数点
- //判断小数点的位数
- NSRange ran = [textField.text rangeOfString:@"."];
- if (range.location - ran.location <= 6) {
- return YES;
- }
- else{
- return NO;
- }
- }else{
- return YES;
- }
- }
- }else{//输入的数据格式不正确
- [self showAlertViewText:@"您输入的格式不正确"];
- [textField.text stringByReplacingCharactersInRange:range withString:@""];
- return NO;
- }
- }
- else
- {
- return YES;
- }
- }
- /**
- 文本字段开始编辑回调
- @param textField <#textField description#>
- */
- - (void)textFieldDidBeginEditing:(UITextField *)textField{
- NSLog(@"textFieldDidBeginEditing");
- if([textField isEqual:self.remark]||[textField isEqual:self.receiptQuantity]||[textField isEqual:self.installReceiptQuantity]){
- if([self.nddelegate respondsToSelector:@selector(keyboardWillShow:)])
- {
- [self.nddelegate keyboardWillShow:self];
- }
- }
- }
- /**
- 文本字段结束编辑回调
- @param textField <#textField description#>
- */
- - (void)textFieldDidEndEditing:(UITextField *)textField{
-
- if([textField isEqual:self.remark]){
- if([self.nddelegate respondsToSelector:@selector(keyboardWillHide:)])
- {
- [self.nddelegate keyboardWillHide:self];
- }
-
- }else if([textField isEqual:self.receiptQuantity]){
- OrderQuantity *quantity = [OrderQuantity new];
- NSInteger decimalPlaces= self.ml.decimalPlaces;
- NSString *receiptQuantity = [quantity calculateReceiptQuantity:[self.ml.circulateType integerValue] decimalPlaces:[NSString stringWithFormat:@"%ld",(long)decimalPlaces] quantity:self.receiptQuantity.text acreage:[self.ml.acreage doubleValue]];
- self.receiptQuantity.text = receiptQuantity;
- self.ml.receiptQuantity = self.receiptQuantity.text;
- [self.nddelegate keyboardWillHide:self];
- }
- else if([textField isEqual:self.installReceiptQuantity]){
- OrderQuantity *quantity = [OrderQuantity new];
- NSInteger decimalPlaces= self.ml.decimalPlaces;
- NSString *receiptQuantity = [quantity calculateReceiptQuantity:[self.ml.circulateType integerValue] decimalPlaces:[NSString stringWithFormat:@"%ld",(long)decimalPlaces] quantity:self.installReceiptQuantity.text acreage:[self.ml.acreage doubleValue]];
- self.installReceiptQuantity.text = receiptQuantity;
- self.ml.installReceiptQuantity = self.installReceiptQuantity.text;
- [self.nddelegate keyboardWillHide:self];
- }
- if([self.nddelegate respondsToSelector:@selector(endEdit:)])
- {
- [self.nddelegate endEdit:self];
- }
- return ;
-
- }
- #pragma mark - 私有函数
- /**
- 设置配送回执单元格UI和数据
- @param model <#model description#>
- @param receiptType <#receiptType description#>
- */
- - (void)parseInfoModel:(NewDispatchRequirementModel *)model receiptType:(NSString*)receiptType receiptFlag:(NSString*)receiptFlag{
- if(model != nil){
- _sReceiptType=receiptType;
- _ml=model;
- UILabel *lblOnlyCode = [UILabel new];
- lblOnlyCode.frame=CGRectMake(20, 8, 80,21);
- lblOnlyCode.text = @"唯一编码:";
- lblOnlyCode.font=kTitleFont;
- [self.contentView addSubview:lblOnlyCode];
- self.lblOnlyCode = [UILabel new];
- self.lblOnlyCode.font=kTitleFont;
- self.lblOnlyCode.frame=CGRectMake(95, 8,SCREENWIDTH-CGRectGetMaxX(lblOnlyCode.frame),21);
- [self.contentView addSubview:self.lblOnlyCode];
-
- self.lblOnlyCode.text=model.onlyCode;
-
- UILabel *lblCode = [UILabel new];
- lblCode.frame=CGRectMake(20, CGRectGetMaxY(lblOnlyCode.frame)+10, 80,21);
- lblCode.text = @"商品编码:";
- lblCode.font=kTitleFont;
- [self.contentView addSubview:lblCode];
- self.code = [UILabel new];
- self.code.font=kTitleFont;
- self.code.frame=CGRectMake(95, CGRectGetMaxY(lblOnlyCode.frame)+10,SCREENWIDTH-CGRectGetMaxX(lblCode.frame),21);
- [self.contentView addSubview:self.code];
-
- UILabel *lblGoodsName = [UILabel new];
- lblGoodsName.frame=CGRectMake(20,CGRectGetMaxY(lblCode.frame)+10, 80,21);
- lblGoodsName.text = @"商品名称:";
- lblGoodsName.font=kTitleFont;
- [self.contentView addSubview:lblGoodsName];
- self.goodsName = [UILabel new];
- self.goodsName.font=kTitleFont;
- self.goodsName.frame=CGRectMake(95, CGRectGetMaxY(lblCode.frame)+10,SCREENWIDTH-CGRectGetMaxX(lblGoodsName.frame),21);
- [self.contentView addSubview:self.goodsName];
-
- UILabel *lblDeliveryQuantity = [UILabel new];
- lblDeliveryQuantity.frame=CGRectMake(20, CGRectGetMaxY(lblGoodsName.frame)+10,80, 21);
- lblDeliveryQuantity.font=kTextFont;
- lblDeliveryQuantity.text = @"送货数量:";
- [self.contentView addSubview:lblDeliveryQuantity];
- self.deliveryQuantity = [UILabel new];
- self.deliveryQuantity.font=kTextFont;
- self.deliveryQuantity.frame=CGRectMake(95, CGRectGetMaxY(lblGoodsName.frame)+10, 200, 21);
- [self.contentView addSubview:self.deliveryQuantity];
-
-
- UILabel *lbTitleInstallQuantity = [UILabel new];
- lbTitleInstallQuantity.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(lblGoodsName.frame)+10,75,21);
- lbTitleInstallQuantity.text = [NSString stringWithFormat:@"安装数量:"];
- lbTitleInstallQuantity.font=kTextFont;
- [self.contentView addSubview:lbTitleInstallQuantity];
-
- UILabel *lbInstallQuantity = [UILabel new];
- lbInstallQuantity.frame=CGRectMake(CGRectGetMaxX(lbTitleInstallQuantity.frame),CGRectGetMaxY(lblGoodsName.frame)+10,75,21);
-
- lbInstallQuantity.font=kTextFont;
- [self.contentView addSubview:lbInstallQuantity];
-
- lbInstallQuantity.text=model.installQuantity;
-
-
- UILabel *lblTitleDeliveryFinishQuantity = [UILabel new];
- lblTitleDeliveryFinishQuantity.frame=CGRectMake(20, CGRectGetMaxY(lblDeliveryQuantity.frame)+10,100, 21);
- lblTitleDeliveryFinishQuantity.font=kTextFont;
- lblTitleDeliveryFinishQuantity.text = @"已送货数量:";
- [self.contentView addSubview:lblTitleDeliveryFinishQuantity];
- self.lblFinalDeliveryReceiptQuantity = [UILabel new];
- self.lblFinalDeliveryReceiptQuantity.font=kTextFont;
- self.lblFinalDeliveryReceiptQuantity.frame=CGRectMake(120, CGRectGetMaxY(lblDeliveryQuantity.frame)+10, 200, 21);
- [self.contentView addSubview:self.lblFinalDeliveryReceiptQuantity];
-
- self.lblFinalDeliveryReceiptQuantity.text=model.finalDeliveryReceiptQuantity;
- UILabel *lbTitleFinalInstallQuantity = [UILabel new];
- lbTitleFinalInstallQuantity.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(lblDeliveryQuantity.frame)+10,100,21);
- lbTitleFinalInstallQuantity.text = [NSString stringWithFormat:@"已安装数量:"];
- lbTitleFinalInstallQuantity.font=kTextFont;
- [self.contentView addSubview:lbTitleFinalInstallQuantity];
-
- _lblFinalInstallReceiptQuantity = [UILabel new];
-
- _lblFinalInstallReceiptQuantity.frame=CGRectMake(CGRectGetMaxX(lbTitleFinalInstallQuantity.frame),CGRectGetMaxY(lblDeliveryQuantity.frame)+10,200,21);
-
- _lblFinalInstallReceiptQuantity.font=kTextFont;
- [self.contentView addSubview:_lblFinalInstallReceiptQuantity];
-
- _lblFinalInstallReceiptQuantity.text=model.finalInstallReceiptQuantity;
-
- UILabel *lblTitleOutQuantity = [UILabel new];
- lblTitleOutQuantity.frame=CGRectMake(20, CGRectGetMaxY(lblTitleDeliveryFinishQuantity.frame)+10,100, 21);
- lblTitleOutQuantity.font=kTextFont;
- lblTitleOutQuantity.text = @"出库数量:";
- [self.contentView addSubview:lblTitleOutQuantity];
- self.lblOutQuantity = [UILabel new];
- self.lblOutQuantity.font=kTextFont;
- self.lblOutQuantity.frame=CGRectMake(120, CGRectGetMaxY(lblTitleDeliveryFinishQuantity.frame)+10,SCREENWIDTH-120, 21);
- [self.contentView addSubview:self.lblOutQuantity];
-
- self.lblOutQuantity.text=model.outQuantity;
-
-
- UILabel *lblReceiptType = [UILabel new];
- lblReceiptType.frame=CGRectMake(20,CGRectGetMaxY(lblTitleOutQuantity.frame)+10, 100,21);
- lblReceiptType.text = @"配送回执类型:";
- lblReceiptType.font=kTextFont;
- [self.contentView addSubview:lblReceiptType];
- self.btstate = [UIButton buttonWithType:UIButtonTypeCustom];
- self.btstate.frame=CGRectMake(CGRectGetMaxX(lblReceiptType.frame),CGRectGetMaxY(lblTitleOutQuantity.frame)+10,80, 21);
- self.btstate.titleLabel.font=kTextFont;
- self.btstate.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
- [self.btstate setTitle:model.receiptTypeName forState:UIControlStateNormal];
- [self.btstate setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
- [self.contentView addSubview:self.btstate];
-
- UILabel *lblInstallReceiptType = [UILabel new];
- lblInstallReceiptType.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(lblTitleOutQuantity.frame)+10, 100,21);
- lblInstallReceiptType.text = @"安装回执类型:";
- lblInstallReceiptType.font=kTextFont;
- [self.contentView addSubview:lblInstallReceiptType];
- self.btnInstallState = [UIButton buttonWithType:UIButtonTypeCustom];
- self.btnInstallState.frame=CGRectMake(CGRectGetMaxX(lblInstallReceiptType.frame),CGRectGetMaxY(lblTitleOutQuantity.frame)+10,80, 21);
- self.btnInstallState.titleLabel.font=kTextFont;
- self.btnInstallState.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
- [self.btnInstallState setTitle:model.installReceiptTypeName forState:UIControlStateNormal];
- [self.btnInstallState setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
- [self.contentView addSubview:self.btnInstallState];
-
-
- UILabel *lblReceiptQuantity = [UILabel new];
- lblReceiptQuantity.frame=CGRectMake(20,CGRectGetMaxY(lblReceiptType.frame)+10,100,21);
- lblReceiptQuantity.text = @"配送回执数量:";
- lblReceiptQuantity.font=kTextFont;
- [lblReceiptQuantity setTextColor:[UIColor blackColor]];
- [self.contentView addSubview:lblReceiptQuantity];
-
- self.receiptQuantity = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMaxX(lblReceiptQuantity.frame),CGRectGetMaxY(lblReceiptType.frame)+10,Screen_Width/2-CGRectGetMaxX(lblReceiptQuantity.frame),21)];
- self.receiptQuantity.font=kTextFont;
- [self.contentView addSubview:self.receiptQuantity];
-
-
-
- UILabel *lblInstallQuantity = [UILabel new];
- lblInstallQuantity.frame=CGRectMake(Screen_Width/2,CGRectGetMaxY(lblReceiptType.frame)+10,100,21);
- lblInstallQuantity.text = @"安装回执数量:";
- lblInstallQuantity.font=kTextFont;
- [lblInstallQuantity setTextColor:[UIColor hexColor:@"c32000"]];
- [self.contentView addSubview:lblInstallQuantity];
-
- self.installReceiptQuantity = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMaxX(lblInstallQuantity.frame),CGRectGetMaxY(lblReceiptType.frame)+10,200,21)];
- self.installReceiptQuantity.font=kTextFont;
- self.installReceiptQuantity.placeholder = @"请输入安装回执数量";
- [self.contentView addSubview:self.installReceiptQuantity];
-
- UILabel *lblRemarks = [UILabel new];
- lblRemarks.frame=CGRectMake(20,CGRectGetMaxY(lblReceiptQuantity.frame)+10,80,21);
- lblRemarks.text = @"回执备注:";
- lblRemarks.font=kTextFont;
- [self.contentView addSubview:lblRemarks];
- self.remark = [[UITextField alloc]initWithFrame:CGRectMake(95,CGRectGetMaxY(lblReceiptQuantity.frame)+10,200,21)];
- self.remark.font=kTextFont;
- [self.contentView addSubview:self.remark];
- UIView *separatorView = [UIView new];
- separatorView.frame=CGRectMake(0,CGRectGetMaxY(lblRemarks.frame)+10, Screen_Width, 1);
- separatorView.backgroundColor=LineBackgroundColor;
- [self.contentView addSubview:separatorView];
-
-
- if([receiptType intValue] == 1){
- if([receiptFlag intValue]==1)
- {
- [self.btstate setEnabled:YES];
- [self.btnInstallState setEnabled:NO];
- self.installReceiptQuantity.enabled=NO;
- [lblReceiptType setTextColor:[UIColor hexColor:@"c32000"]];
-
- [lblReceiptQuantity setTextColor:[UIColor hexColor:@"c32000"]];
- [ lblInstallReceiptType setTextColor:[UIColor blackColor]];
- [lblInstallQuantity setTextColor:[UIColor blackColor]];
-
-
- }
-
- if([receiptFlag intValue]==2)
- {
- [self.btstate setEnabled:NO];
- [self.btnInstallState setEnabled:YES];
- self.receiptQuantity.enabled=NO;
- [ lblInstallReceiptType setTextColor:[UIColor hexColor:@"c32000"]];
- [lblInstallQuantity setTextColor:[UIColor hexColor:@"c32000"]];
-
- [lblReceiptType setTextColor:[UIColor blackColor]];
-
- [lblReceiptQuantity setTextColor:[UIColor blackColor]];
-
- }
-
- if([receiptFlag intValue]==3)
- {
- [self.btstate setEnabled:YES];
- [self.btnInstallState setEnabled:YES];
- [ lblInstallReceiptType setTextColor:[UIColor hexColor:@"c32000"]];
- [lblInstallQuantity setTextColor:[UIColor hexColor:@"c32000"]];
-
- [lblReceiptType setTextColor:[UIColor hexColor:@"c32000"]];
-
- [lblReceiptQuantity setTextColor:[UIColor hexColor:@"c32000"]];
-
- }
-
- if ([model.receiptType isEqualToString:@"0"]) {
- self.receiptQuantity.enabled= NO;
- }
- if ([model.receiptType isEqualToString:@"1"]) {
- self.receiptQuantity.enabled= NO;
- }
- if ([model.receiptType isEqualToString:@"2"]) {
- self.receiptQuantity.enabled= YES;
- }
-
- if ([model.installReceiptType isEqualToString:@"0"]) {
- self.installReceiptQuantity.enabled= NO;
- }
- if ([model.installReceiptType isEqualToString:@"5"]) {
- self.installReceiptQuantity.enabled= YES;
- }
- if([model.installReceiptType isEqualToString:@"1"]){
- [self.btnInstallState setTitle:@"完成" forState:UIControlStateNormal];
- self.installReceiptQuantity.enabled= NO;
- }
-
-
-
-
- }
- else if([receiptType intValue] == 2){
- [self.btstate setEnabled:NO];
- [self.btnInstallState setEnabled:NO];
- self.receiptQuantity.enabled=NO;
- self.installReceiptQuantity.enabled=NO;
-
- [lblInstallReceiptType setTextColor:[UIColor blackColor]];
- [lblInstallQuantity setTextColor:[UIColor blackColor]];
-
- [lblReceiptType setTextColor:[UIColor blackColor]];
-
- [lblReceiptQuantity setTextColor:[UIColor blackColor]];
- }
- self.sCode=model.code;
- self.sDeliveryQuantity=model.deliveryQuantity;
- self.sReceiptType=model.receiptType;
-
- self.sReceiptRemarks=model.receiptRemarks;
- self.sOutQuantity=model.outQuantity;
- self.sDetailID=model.detailId;
- self.sInvoiceID=model.invoiceId;
- self.sInvoiceDetailID=model.invoiceDetailId;
- self.code.text=_sCode;
- self.deliveryQuantity.text=_sDeliveryQuantity;
- self.goodsName.text=model.goodsName;
- self.outQuantity.text=_sOutQuantity;
- self.remark.text=_sReceiptRemarks;
- self.remark.placeholder = @"请输入回执备注";
- self.remark.delegate=self;
- self.remark.tag=1001;
- self.receiptQuantity.delegate=self;
- self.receiptQuantity.placeholder = @"请输入回执数量";
- self.receiptQuantity.keyboardType=UIKeyboardTypeDecimalPad;
- self.receiptQuantity.tag=1000;
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFocusPeopleEditingChanged:) name:@"UITextFieldTextDidChangeNotification" object: self.receiptQuantity];
-
- // [self.receiptQuantity addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
- // [self.remark addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
- [self.btstate addTarget:self action:@selector(btnCilck) forControlEvents:UIControlEventTouchUpInside];
-
- // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onFocusPeopleEditingChanged:) name:@"UITextFieldTextDidChangeNotification" object: self.installReceiptQuantity];
- self.installReceiptQuantity.delegate=self;
- self.installReceiptQuantity.tag = 2000;
- self.installReceiptQuantity.keyboardType=UIKeyboardTypeDecimalPad;
- // [self.installReceiptQuantity addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
- [self.btstate setTitle:model.receiptTypeName forState:UIControlStateNormal];
- [self.btnInstallState setTitle:model.installReceiptTypeName forState:UIControlStateNormal];
- self.installReceiptQuantity.text = model.installReceiptQuantity;
- self.receiptQuantity.text=model.receiptQuantity;
-
-
- [self.btnInstallState addTarget:self action:@selector(btnInstallStateCilck) forControlEvents:UIControlEventTouchUpInside];
-
- }
- }
- /**
- 安装状态
- */
- -(void) btnInstallStateCilck{
- if ([self.dispatchDelegate respondsToSelector:@selector(setInstallReceiptType:)]) {
- [self.dispatchDelegate setInstallReceiptType:_myIndexPath];
- }
-
- }
- - (void)setback:(int)mytage:(NSString *)mystateid{
-
- [self.btstate setTitle:@"退货" forState:UIControlStateNormal];
- self.outQuantity.text = @"5";
- _ml.outQuantity = @"5";
-
-
- }
- /**
- 文本框长度限制
- @param sender <#sender description#>
- */
- - (void)onFocusPeopleEditingChanged:(NSNotification *)sender
- {
- UITextField *textField = (UITextField *)sender.object;
- NSString *toBeString = textField.text;
- NSString *lang = [[UIApplication sharedApplication]textInputMode].primaryLanguage;
- int kMaxLength=0;
-
- if([textField isEqual:self.receiptQuantity]||[textField isEqual:self.installReceiptQuantity]){
- kMaxLength=17;
- if (toBeString != nil && toBeString.length>0 && [toBeString floatValue]-MAXIMUM_QUANTITY>0.0000000001f) {
- textField.text = MAX_COUNT ;
- toBeString = MAX_COUNT;
- }
- }
- if ([lang isEqualToString:@"zh-Hans"]) {
- UITextRange *selectedRange = [textField markedTextRange];
- UITextPosition *position = [textField positionFromPosition:selectedRange.start offset:0];
- if (!position) {
- if (toBeString.length > kMaxLength) {
- textField.text = [toBeString substringToIndex:kMaxLength];
- }
- }
- }
- else{
- if (toBeString.length > kMaxLength) {
- textField.text = [toBeString substringToIndex:kMaxLength];
- }
- }
- }
- /**
- 出示警告对话框
- @param text <#text description#>
- */
- - (void)showAlertViewText:(NSString *)text
- {
- UIAlertView*alert = [[UIAlertView alloc]initWithTitle:@"提示"
- message:text
- delegate:nil
- cancelButtonTitle:@"确定"
- otherButtonTitles:nil];
- [alert show];
-
-
- }
- /**
- 回执类型点击事件
- */
- - (void)btnCilck{
- if ([self.dispatchDelegate respondsToSelector:@selector(setDeliveryReceiptType:)]) {
- [self.dispatchDelegate setDeliveryReceiptType:_myIndexPath];
- }
- }
- /**
- 文本字段变化事件
- @param sender <#sender description#>
- */
- - (void)textFieldDidChange:(UITextField*) sender{
- UITextField* txt=sender;
-
- if([self.nddelegate respondsToSelector:@selector(textValueChange:txtField:qualityField:remarkField:)])
- {
- [self.nddelegate textValueChange:self txtField:txt qualityField:nil remarkField:nil];
-
- }
- }
- @end
|