# 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的更多相关文章

随机推荐

  1. Git学习(一) 版本号管理工具

    Git 是一个分布式版本号控制工具.它的作者 Linus Torvalds 是这样给我们介绍 Git  -- The stupid content tracker(傻瓜式的内容跟踪器) 1. Git ...

  2. 最新Connectify注冊码(序列号) Connectify3.7序列号 破解版

    Connectify序列号.最新注冊码 今天给大家公布一个Connectify最新版的序列号(注冊码) 今天给大家公布一个Connectify最新版的序列号(注冊码) 经本人測试该注冊码为最新版Con ...

  3. android 02 登录

    activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android& ...

  4. mysql 安装配置详解

    作为演示,是不可能完全模拟到生产环境的,因此不可能尽善尽美.由于是在virtualbox里面的centos6.5最小化安装版中安装配置mysql,因此前期的准备工作有很多,那么开始吧.添加一块硬盘,用 ...

  5. 第三篇:python高级之生成器&迭代器

    python高级之生成器&迭代器   python高级之生成器&迭代器 本机内容 概念梳理 容器 可迭代对象 迭代器 for循环内部实现 生成器 1.概念梳理 容器(container ...

  6. jQuery失去焦点的时候注册验证

    //注册验证$('form :input').blur(function () { if ($("#txtName").val() == "") { $(&qu ...

  7. 别人走的路--uap

    首先,我先谈谈我个人的经历,我今年34岁了,做了10多年的ERP实施顾问,大学刚毕业的时候是做ERP软件开发的,后来转岗做了实施顾问.根据我的个人经验,我给你几点建议.1.既然是很大的公司,那么ERP ...

  8. session marked for kill处理oracle中杀不掉的锁

    ora-00031:session marked for kill处理oracle中杀不掉的锁   一些ORACLE中的进程被杀掉后,状态被置为"killed",但是锁定的资源很长 ...

  9. power desinger 学习笔记<五>

    怎样才能在修改表的字段Name的时候,Code不自动跟着变 tools-> General   Options-> Dialog:Operation   Modes: 去掉 NameToC ...

  10. iOS-NSSDate的使用

    取当前时间的秒数 NSTimeInterval time = [[NSDate date] timeIntervalSince1970];long long int date = (long long ...