# 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. 怎样在delphi中实现控件的拖拽

    下面这2种方法都能实现对控件和窗体的拖拽 方法1 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift ...

  2. [RxJS] Filtering operators: distinct and distinctUntilChanged

    Operator distinct() and its variants are an important type of Filtering operator. This lessons shows ...

  3. [CSS] Animating SVG

    <!DOCTYPE> <html lang='en'> <head> <meta charset='utf-8'> <title>Cospl ...

  4. 重复记录(duplicate records)相关运营数据

    MySQL 中查找反复数据,删除反复数据 创建表和測试数据 /* 表结构 */ DROPTABLEIFEXISTS `t1`; CREATETABLEIFNOTEXISTS `t1`( `id` IN ...

  5. Bit data type

    mysql> create table t(a bit()); Query OK, rows affected (0.04 sec) mysql> insert into t '; Que ...

  6. Log4J2基本配置

    [1]. Log4J2入门: <1>. 导入Jar包: log4j-api-2.0-beta9.jar log4j-core-2.0-beta9.jar <2>. 编写代码: ...

  7. SQL语句优化(分享)

    一.操作符优化 1.IN 操作符 用IN写出来的SQL的优点是比较容易写及清晰易懂,这比较适合现代软件开发的风格.但是用IN的SQL性能总是比较低的,从Oracle执行的步骤来分析用IN的SQL与不用 ...

  8. 自己动手写控件(模仿mvc htmlhelper的类)

    自定义helper类,要求命名空间在 System.Web.Mvc之下,要求,静态类,静态方法,特殊生成对应html的返回字段, 传递Htmlhleper,返回特定类型 返回值是MvcHtmlStri ...

  9. 在vSphere5.0虚拟机里的Ubuntu Server 32位安装JDK

    本机操作系统Win7 服务器用vSphere 5.0 虚拟机  在虚拟机安装了Ubuntu Server 12.04 1.首先到Oracle官网上下载jdk-7u51-linux-i586.tar.g ...

  10. ORACLE多表关联UPDATE 语句

    转载至:http://blog.itpub.net/29378313/viewspace-1064069/ 为了方便起见,建立了以下简单模型,和构造了部分测试数据:在某个业务受理子系统BSS中, SQ ...