首页 > 其他 > 详细

CELL_PHOTO_IDENTIFIER

时间:2014-12-30 09:15:02      阅读:256      评论:0      收藏:0      [点我收藏+]

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

    }] ;

  }

}

CELL_PHOTO_IDENTIFIER

原文:http://www.cnblogs.com/yushunwu/p/4192817.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!