uicollectionviewflowlayout

UIWebView和UICollectionViewController

被刻印的时光 ゝ 提交于 2019-12-10 06:00:32
UIWebView和UICollectionViewController的使用 UIWebView UIWebView是iOS内置的浏览器的控件, 可以浏览网页, 打开文档等 .系统自带的Safari浏览器就是通过UIWebView实现的, 能够加载html/htm, pdf, docx, txt等格式的文件. 在iOS7之前, UILabel, UITextFiled 以及 UITextView 都在后台以某种方式使用 WebKit来进行文本布局和渲染. 渲染 : 是CG的最后一道工序, 将所设计内容制作成最终效果图或者动画的过程 . UIWebView的使用 1> 确定要访问的资源 NSURL *url = [NSURL URLWithString : @"http://www.baidu.com"]; 2> 建立网络请求 NSURLRequest *request = [NSURLRequest requestWithURL :url]; 3> UIWebView加载网络请求 [self.webView loadRequest : request]; UIWebView - 实现百度搜索 -(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { NSString *str = searchBar.text;

UICollectionView items order not reversed in right to left languages

心不动则不痛 提交于 2019-12-06 05:29:23
问题 I noticed a big issue where in right to left languages, the cells order is not properly reversed, only the alignment is correct. But only for horizontal flow layout, and if the collection view contain different cell sizes ! Yes, I know this sound insane. If all the cells are the same size, the ordering and alignment is good! Here is what I got so far with a sample app (isolated to make sure this is the actual issue, and not something else): (First bar should always be drawn blue, then size

UICollectionView - random cells are selected

試著忘記壹切 提交于 2019-12-02 11:29:59
问题 I have a Horizontal UICollectionView like the horizontal Calender in iOS. Paging is enabled but not allowsMultipleSelection. self.allowsMultipleSelection = false self.isPagingEnabled = true There are only 5 cells per page. let cellSize = CGSize(width: self.view.frame.width / 5 , height: 60) CollectionView's height is also 60. didSelectItemAt change background color to .red and didDeselectItem resets it to .white . func collectionView(_ collectionView: UICollectionView, didSelectItemAt

iOS流布局UICollectionView系列三——使用FlowLayout进行更灵活布局

[亡魂溺海] 提交于 2019-12-02 09:10:08
iOS流布局UICollectionView系列三——使用FlowLayout进行更灵活布局 一、引言 前面的博客介绍了UICollectionView的相关方法和其协议中的方法,但对布局的管理类UICollectionViewFlowLayout没有着重探讨,这篇博客介绍关于布局的相关设置和属性方法。 UICollectionView的简单使用: http://my.oschina.net/u/2340880/blog/522613 UICollectionView相关协议方法: http://my.oschina.net/u/2340880/blog/522613 通过layout的设置,我们可以编写更加灵活的布局效果。 二、将九宫格式的布局进行升级 在第一篇博客中,通过UICollectionView,我们很轻松的完成了一个九宫格的布局,但是如此中规中矩的布局方式,有时候并不能满足我们的需求,有时我们需要每一个Item展示不同的大小,代码如下: - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. UICollectionViewFlowLayout *layout = [

UICollectionView - random cells are selected

做~自己de王妃 提交于 2019-12-02 06:58:15
I have a Horizontal UICollectionView like the horizontal Calender in iOS. Paging is enabled but not allowsMultipleSelection. self.allowsMultipleSelection = false self.isPagingEnabled = true There are only 5 cells per page. let cellSize = CGSize(width: self.view.frame.width / 5 , height: 60) CollectionView's height is also 60. didSelectItemAt change background color to .red and didDeselectItem resets it to .white . func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let cell = collectionView.cellForItem(at: indexPath) if let cell = cell { cell

UICollectionView - distance between cells?

怎甘沉沦 提交于 2019-11-30 04:34:53
I'm using a UICollectionView with the cell width of 67, right now I am using a flow layout. I have 3 cells in a row with 30px space between cells. How can make that distance less, so that I can fit four cells in a row? Does this method have something to do with it? - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { return UIEdgeInsetsMake(10, 10, 10, 10); } This UICollectionViewFlowLayoutDelegate method will help you.. - (CGFloat)collectionView:(UICollectionView *)collectionView

How to show a collectionView like facebook upload image using swift 4?

混江龙づ霸主 提交于 2019-11-29 05:21:56
Hello i want to show the collectionView exactly as the above image. I know that it responsible for UICollectionViewFlowLayout, but unable to do it. Help is much appreciated. Here is my code func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let yourWidth = (collectionView.bounds.width - 4) / 3.0 let yourHeight = yourWidth return CGSize(width: yourWidth, height: yourHeight) } Your answer is in your question bro some short of conditions func collectionView(_ collectionView: UICollectionView,

UICollectionView - distance between cells?

情到浓时终转凉″ 提交于 2019-11-29 01:50:01
问题 I'm using a UICollectionView with the cell width of 67, right now I am using a flow layout. I have 3 cells in a row with 30px space between cells. How can make that distance less, so that I can fit four cells in a row? Does this method have something to do with it? - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { return UIEdgeInsetsMake(10, 10, 10, 10); } 回答1: This

UICollectionViewFlowLayout estimatedItemSize does not work properly with iOS12 though it works fine with iOS 11.*

好久不见. 提交于 2019-11-28 19:11:59
For UICollectionView's dynamic height cells we use, if let layout = self.collectionViewLayout as? UICollectionViewFlowLayout { layout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize } with the proper constraint of height and width, it works fine with iOS 11.* versions but it breaks and does not make the cells dynamic for iOS 12.0 ale84 In my case, I solved this by explicitly adding the following constraints to the cell's contentView. class Cell: UICollectionViewCell { // ... override func awakeFromNib() { super.awakeFromNib() // Addresses a separate issue and prevent auto layout