# 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. [转]Android中dp,px,sp概念梳理以及如何做到屏幕适配

    http://blog.csdn.net/jiangwei0910410003/article/details/40509571 今天又开始我的App开发,因为之前一直做的是SDK,所以涉及到界面UI ...

  2. c++ 字符串流 sstream(常用于格式转换) 分类: C/C++ 2014-11-08 17:20 150人阅读 评论(0) 收藏

    使用stringstream对象简化类型转换 C++标准库中的<sstream>提供了比ANSI C的<stdio.h>更高级的一些功能,即单纯性.类型安全和可扩展性.在本文中 ...

  3. Objective-c Category使用

    Objective-c  Category使用 转载:http://blog.csdn.net/lovefqing/article/details/8289851 什么是Category Catego ...

  4. Driving the Activity Lifecycle

    Before Robolectric 2.2, most tests created Activities by calling constructors directly, (new MyActiv ...

  5. inverse 相关设置

    <set name="students" table = "student" inverse="true"> <!-- 指 ...

  6. 点击其它地方隐藏div/事件冒泡/sweet-alert阻止冒泡

    点击document时把div隐藏,但点击div时阻止点击事件冒泡到document,从而实现“点击文档其它地方隐藏div,点击div本身不隐藏”.js代码如下:$("#div") ...

  7. linux进程地址空间详解(转载)

    linux进程地址空间详解(转载) 在前面的<对一个程序在内存中的分析 >中很好的描述了程序在内存中的布局,这里对这个结果做些总结和实验验证.下面以Linux为例(实验结果显示window ...

  8. java的各个队列之间的联系和区别是什么

    java的各个并发队列之间的联系和区别 java.util.concurrent是在并发编程中很常用的实用工具类 ArrayBlockingQueue, DelayQueue, LinkedBlock ...

  9. zabbix 基于JMX的Tomcat监控

    zabbix 基于JMX的Tomcat监控 一.环境 ubuntu14.04 LTS Java 1.7.0 zabbix 2.4.5 二.安装配置 1.安装JavaGateway 在ubuntu14. ...

  10. tomcat发布项目时,空文件夹未发布成功

    问题背景: 项目发布到服务器时,缺少文件夹,到时向此文件夹写数据时发生错误. 后来经查,缺少这个文件夹,项目部署发布时,并不会把空文件夹发布上去 解决: 1.在空文件中加入,一个文件.就可以发布成功 ...