设置包含tableView的collectionView的contentInset

时间:2018-11-16 03:18:10

标签: ios swift uitableview uicollectionview keyboard

我的情况是我有一个collectionView,其中包含两种类型的单元格。第一种单元格类型是简单的可编辑UITextField,第二种单元格包含一个UITableView,其单元格内部具有可编辑的UITextFields。

我的问题是,由于表视图单元格内的文本字段而导致键盘出现并且我更改了$ xcrun usdz_converter ~/Desktop/obj_file/demo.obj ~/Desktop/obj_file/demo.usdz -v -a -l objc[969]: Class MDLTSUZipReadChannel is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025898) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x1080001d0). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUZipFileWriter is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff870255c8) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000220). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSULogCatThreadSafeMutableSet is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025758) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000270). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUContainedZipArchive is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025a28) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x1080002c0). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSULogHelper is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025398) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000310). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUIOUtils is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025640) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000388). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUZipWriter is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025c08) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x1080003b0). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUZipWriterEntry is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025c30) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x1080003d8). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUBundleLookupClass is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff870257d0) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x1080004c8). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUTemporaryDirectory is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025988) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x1080004f0). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUFileIOChannel is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025438) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000540). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUEncodedBlockInfoInternal is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff870257f8) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000590). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUEncodedBlockInfoWithDecodedLengthInternal is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025848) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x1080005e0). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUReadChannelInputStreamAdapter is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff870253e8) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000630). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUZipFileArchive is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff870256b8) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000680). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUZipFileDescriptorWrapper is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff870256e0) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x1080006a8). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUZipArchive is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff870258e8) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000720). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUZipEntry is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025a00) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000798). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUAssertionHandler is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025550) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000838). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUBufferedReadChannel is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025ca8) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000860). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUBufferedReadChannelHelper is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025cd0) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000888). One of the two will be used. Which one is undefined. objc[969]: Class MDLTSUZipInflateReadChannel is implemented in both /System/Library/Frameworks/ModelIO.framework/Versions/A/ModelIO (0x7fff87025668) and /Applications/Xcode.app/Contents/Developer/usr/bin/usdz_converter.dylib (0x108000900). One of the two will be used. Which one is undefined. usdz_converter Version: 1.008 -v: Verbose output -a: Generate .usda intermediate file -l: Leave generated .usda file 时,更改没有发生。

这是我用来更改键盘出现时的插入的代码,并且与选择“收集视图”单元格中的文本字段时的代码相同(有效)。

contentInset

肯定有一些我无法想到的事情阻止了contentInsets的改变。

我也有一个自定义self.view.setNeedsLayout() self.collectionView.contentInset.bottom = inset self.view.layoutIfNeeded() ,尽管我认为这无关紧要,因为那只与collectionView的内容有关,而与插图无关。

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

证明它起作用的原因是因为其中包含textview的单元格正在进行一些神奇的自动滚动,而具有tableview textview的单元格却没有进行自动滚动,我猜测是因为它已经嵌套在视图堆栈中处理这个。

我的解决方法是调整contentOffset以强制滚动。