• CELL_PHOTO_IDENTIFIER


    # define CELL_PHOTO_IDENTIFIER @"photoLibraryCell"

    # define CLOSE_PHOTO_IMAGE @"close"

    # define ADD_PHONE_IMAGE @"photo"

    - (ALAssetsLibrary *) defaultAssetLibrairy {

      static ALAssetsLibrary *assetLibrairy;

      static dispatch_once_t onceToken;

      dispatch_once(&onceToken, ^{

        assetLibriry =[[ALAssetsLibrary alloc]init];

      });

      return (assetLibrary);

    }

    - (BOOL) shouldAutorotate {

      return (false);

    }

    - (void) postMessage {

      RRMessageModel *modelMessage = [[RRMessageModel alloc]init];

      modelMessage.text = self.textView.text;

      modelMessage.photos = self.selectedPhotos;

      if(self.completion != nil) {

        self.completion(modelMessage, false);

      }

      if([self.delegate respondsToSelector:@selector(getMessage:)])

     {

        [self.delegate getMessage:modelMessage];

      }}

    - (void) cancelMessage {

      if([self.delegate respondsToSelector:@selector(messageCancel)]) {

        [self.delegate messageCancel];

      }

      if(self.completion != nil) {

        self.completion(nil, true);

      }

    }

    - (void) textViewDidChange :(UITextView *)textView {

      self.numberLine.text = [NSString stringWithFormat:@"%lu", (unsigned long)self.textView.text.length];

    }

    - (NSInteger) collectionView:(UICollectionView *) {

      return (self.photosThumnailLIbray.count);

    }

    - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView

                      cellForItemAtIndexPath:(NSIndexPath *)indexPath {

      UICollectionViewCellPhoto *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CELL_PHOTO_IDENTIFIER forIndexPath:indexPath];

      cell.photo.image = [self.photosThumbnailLibrary objectAtIndex:indexPath.row];

      return (cell);

    }

     

    - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {

      if(self.numberPhoto != -1  && self.selectedPhotos.count >= self.numberPhoto) {

        return;

      }

     

      if(self.selectedPhotos.count == 0) {

        CGFloat positionY = self.textView.frame.origin.y + self.textView./frame.size.height/2;

        CGFloat sizeHeight = self.textView.frame.size.height /2;

        [UIView animateWIthDuration:0.5 animations:^{

          self.textView.frame = CGRectMake(self.textView.frame.origin.x, self.textView.frame.orin.y, self.textView.frame.size.width,self.textView.frame.size.height/2);

        } completion:^(BOOL finished) {

          NSRange bottom = NSMakeRange(self.textView.text.length -1 , 1);

          [self.textView scrollRangeToVisible:bottom];

        }] ;

      }

    }

  • 相关阅读:
    菜单范式
    PIC18F26K20
    单片机中串口通信模型
    STM8S103之GPIO
    STM8S103之ADC
    二叉树最近公共祖先
    全排列
    整数翻转
    完全二叉树节点个数
    二叉树的深度
  • 原文地址:https://www.cnblogs.com/yushunwu/p/4192817.html
Copyright © 2020-2023  润新知