zoukankan      html  css  js  c++  java
  • 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];

        }] ;

      }

    }

  • 相关阅读:
    【LeetCode每日一题】2020.6.9 面试题46. 把数字翻译成字符串
    【NOIP2017提高A组模拟9.17】信仰是为了虚无之人
    【NOIP2017提高A组模拟9.17】猫
    【NOIP2017提高A组模拟9.17】组合数问题
    JZOJ 11.21 提高B组反思
    【NOIP2017提高A组模拟9.12】Arrays and Palindrome
    JZOJ【NOIP2013模拟联考14】隐藏指令
    JZOJ 11.14 提高B组反思
    CSP2020复赛游记
    JZOJ 【NOIP2017提高A组模拟9.14】捕老鼠
  • 原文地址:https://www.cnblogs.com/yushunwu/p/4192817.html
Copyright © 2011-2022 走看看