contentsize

UIWebview scrollview changes contentsize for no reason

北战南征 提交于 2019-12-22 08:34:09
问题 I have a uiviewcontroller which loads a uiwebview. When the uiviewcontroller loads the uiwebview everything is done correctly. But when one navigates away and returns back and the uiwebview is not loaded, it is displayed differently. The uiwebview scrollview's contentsize height changes by 64px, it gets higher. When it is loaded for the first it looks like this When one returns back to the view, this is what happens I hope I was able to make my problem understandable. If more details are

UITextView doesn't update its contentSize

和自甴很熟 提交于 2019-12-22 03:16:55
问题 I'm dynamically sizing a UITextView 's height and the height of the UITableViewCell it is embedded in when its content changes. But I also have the ability to paste in predefined bits of texts. As this pasting happens programmatically, the problem is, that after adding the selected text bit to the UITextView 's text and calling my UITableView to update its cell heights, the UITextView hasn't yet updated its contentSize, which I use to calculate the cell's height. Is there a way to force a

Preventing “wrapping” of items in UICollectionView

拟墨画扇 提交于 2019-12-21 04:34:04
问题 I need a UICollectionView to display a grid that is potentially larger than the visible frame in both width and height, while maintaining row and column integrity. The default UICollectionViewFlowLayout allows sections to scroll off-screen, but it wraps items within a section to keep them all on-screen, which screws up my grid. Recognizing that UICollectionView is a subclass of UIScrollView , I tried just manually setting the collection view's content size property in viewDidLoad: self

UIScrollView ContentSize.height is 0.0000 by default?

拟墨画扇 提交于 2019-12-14 02:10:26
问题 I am trying to create a dynamic form using a UIScrollView, but I noticed when I used a NSLog that my scrollView's contentSize.height = 0.00000 I built the scrollView to the width and height of the screen on storyboard with elements inside it. So why does it return 0? All the elements inside the scrollView are showing/functioning correctly. Does scrollView's contentSize always default at 0 and I just need to set it? 回答1: Yes is 0 by default. You should set the content size of your scrollview

scrollView not scrolling swift

∥☆過路亽.° 提交于 2019-12-12 05:52:05
问题 I have a scroll view which is not scrolling. Googling seems to indicate that it may be to do with my constraints? My constraints are as follows: Trailing space to superview = -16 Leading space to superview = -16 Top space to top layout guide = 0 Bottom space to bottom layout guide = -13 I am printing out the scrollview contentSize in the viewDidLayoutSubViews and it is printing out the same value each time i.e: scrollview is (375.0, 356.5) Any idea what the issue may be 回答1: Check the bottom

IOS 中 contentsize contentoffset contentInset的区别

让人想犯罪 __ 提交于 2019-12-10 17:06:01
contentSize是scrollview可以滚动的区域,比如frame = (0 ,0 ,320 ,480) contentSize = (320 ,960),代表你的scrollview可以上下滚动,滚动区域为frame大小的两倍。 contentOffset是scrollview当前显示区域顶点相对于frame顶点的偏移量,比如上个例子你拉到最下面,contentoffset就是(0 ,480),也就是y偏移了480 contentInset 是scrollview的contentview的顶点相对于scrollview的位置,例如你的 contentInset = (0 ,100),那么你的contentview就是从scrollview的(0 ,100)开始显示 另外UITableView是UIScrollView的子类,它们在上述属性又有所不同,tabelview的contentsize是由它的下列方法共同实现的 - (NSInteger)numberOfSections; - (NSInteger)numberOfRowsInSection:(NSInteger)section; - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

Masonry 约束Scrollview问题

南楼画角 提交于 2019-12-09 12:28:34
##问题描述 开发中遇到了关于Masonry对于Scrollview的contentSize的设置问题。通过阅读Masonry的源码,我最终找到了我想要的方法。 其实问题很简单,也因为我个人对于Masonry使用还不够熟练(平时用stb挺多。。)。 实际情况是这样的,我要在一个简单的视图中显示一个标题,一个时间,还有一个文字内容,文字内容不定,可能会很多,多到超出这个屏幕,由于是很固定的屏幕布局,我采用的方式是,ScrollView加上一个容器View(contentView), 还有三个label即可,三个label加到contentView上,使用Masonry进行布局。 这里涉及到contentSize的地方就是其中一个label是放置内容的我们叫做contentLabel,这个是多行显示,高度不定,由于这个视图是加到了contentView上,contentView的高度决定了ScrollView的contentSize,于是要做的就是保证contentLabel的高度动态变化的同时contentView的高度也要动态变化,才能够保证超出屏幕之后,可以滑动查看超出的内容文字。多余的不说了,看代码吧。可能代码写的不好,希望大家可以指正:flushed: ##代码 @interface DemoVC () { UIScrollView * _scrollView; UIView

iOS UIWebView with changing content size

孤者浪人 提交于 2019-12-05 18:32:52
I have a UIWebView which i've set the height of the WebView to [[webView stringByEvaluatingJavaScriptFromString:@"document.body.offsetHeight"] floatValue]; This works fine but on my webpage I have a menu which is expandable, so when the webpage is changing it's height the WebView doesn't increase/decrease it's size. Any tips how I can make my UIWebView change height dynamically when the webpage is changing its size? I would very much like to keep the UIWebView's size = webpage so I never have to scroll in the WebView. you can set sizeToFit property and again set Frame of UIWebView in

UIWebview scrollview changes contentsize for no reason

时间秒杀一切 提交于 2019-12-05 14:29:28
I have a uiviewcontroller which loads a uiwebview. When the uiviewcontroller loads the uiwebview everything is done correctly. But when one navigates away and returns back and the uiwebview is not loaded, it is displayed differently. The uiwebview scrollview's contentsize height changes by 64px, it gets higher. When it is loaded for the first it looks like this When one returns back to the view, this is what happens I hope I was able to make my problem understandable. If more details are necessary, I am able to give more. Thank you I had a similar problem, try this code in your viewDidLoad

UITextView doesn't update its contentSize

情到浓时终转凉″ 提交于 2019-12-05 00:07:19
I'm dynamically sizing a UITextView 's height and the height of the UITableViewCell it is embedded in when its content changes. But I also have the ability to paste in predefined bits of texts. As this pasting happens programmatically, the problem is, that after adding the selected text bit to the UITextView 's text and calling my UITableView to update its cell heights, the UITextView hasn't yet updated its contentSize, which I use to calculate the cell's height. Is there a way to force a UITextView to update its contentSize , after I programmatically add text to it? Dima You can use