20141211笔记(UIImageView 设置内容的Mode的方法\UICollectionViewCell Custom的方法\ios modal segue code)
2014-12-10 23:03
609 查看
1、UIImageView设置内容的Mode的方法 imageView.contentMode=UIViewContentModeScaleAspectFill; 2、UICollectionViewCellCustom的方法 CustomUICollectionViewCell.m
-(id)initWithFrame:(CGRect)frame{ if(self=[superinitWithFrame:frame]){ [selfinitUI]; } returnself; } -(void)initUI{ //TODO }
然后在collectionView中注册这个
CustomUICollectionViewCell
UICollectionViewFlowLayout*flowLayout=[[UICollectionViewFlowLayoutalloc]init]; collectionView=[[UICollectionViewalloc]initWithFrame:CGRectZerocollectionViewLayout:flowLayout]; [collectionViewsetTranslatesAutoresizingMaskIntoConstraints:NO]; [collectionViewsetBackgroundColor:[UIColorclearColor]]; [collectionViewregisterClass:[CustomCollectionViewCellclass]forCellWithReuseIdentifier:@"MY_CELL"]; collectionView.dataSource=self; collectionView.delegate=self;
最后在datasource函数中复用Cell
-(UICollectionViewCell*)collectionView:(UICollectionView*)cvcellForItemAtIndexPath:(NSIndexPath*)indexPath{ CustomCollectionViewCell*cell=[cvdequeueReusableCellWithReuseIdentifier:@"MY_CELL"forIndexPath:indexPath]; returncell; }
这就是CollectionViewCell的Custom流程
3、iosmodalseguecode
-(IBAction)pushMyNewViewController { MyNewViewController*myNewVC=[[MyNewViewControlleralloc]init]; //doanysetupyouneedformyNewVC [selfpresentModalViewController:myNewVCanimated:YES];//被弃用
[selfpresentViewController:viewControlleranimated:YEScompletion:nil];//被这个代替
}
[selfdismissViewControllerAnimated:YEScompletion:nil];//dismissview
相关文章推荐
- iOS开发笔记--解决UITableView中Cell重用机制导致内容出错的方法总结
- iOS开发笔记--解决UITableView中Cell重用机制导致内容出错的方法总结
- iOS开发笔记--解决UITableView中Cell重用机制导致内容出错的方法总结
- IOS开发 UITableView中Cell重用机制导致内容重复解决方法
- 详解iOS开发中UITableview cell 顶部空白的多种设置方法
- IOS学习笔记(十)之UIImageView图片视图的基本概念和使用方法
- IOS UITableViewCell 设置 UIImageView属性 位置
- iOS UIcollectionView 和 UITableView 限制item 或cell的交换方法
- ios tableView那些事 (十六) UITableView中Cell重用机制导致内容重复解决方法
- ios tableView那些事 (十六) UITableView中Cell重用机制导致内容重复解决方法
- 【IOS 开发学习总结-OC-55】故事板中 segue 的 push、modal、popover、replace、custom 学习笔记
- IOS 笔记 - 利用UIImage的stretchableImageWithLeftCapWidth方法给UIButton设置背景
- ios开发笔记之如何让tableView根据文本内容动态改变cell的高度
- IOS--UIViewUIButtonUIImageView设置圆角、阴影、边框的方法
- ios tableView那些事 (十六) UITableView中Cell重用机制导致内容重复解决方法
- 【IOS学习笔记】为UICollectionView设置自适应屏幕宽度以及点击效果
- [ios]tableView内部cell因内容大小变换 而变化 sizeWithFont:constrainedToSize: lineBreakMode:
- 学习笔记一:UIImage初始化方法以及点击UICollectionView和遇到点击的TableViewCell
- IOS学习笔记(十)之UIImageView图片视图的基本概念和使用方法
- ios tableView那些事 (十六) UITableView中Cell重用机制导致内容重复解决方法