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];

    }] ;

  }

}

时间: 2024-10-14 05:23:34

CELL_PHOTO_IDENTIFIER的相关文章