contentsize

UIScrollview content size when orientation changes

流过昼夜 提交于 2019-12-04 03:37:56
问题 I have a scrollview with pagination. In viewDidLoad i check if the current orientation is landscape then i set its contentsize's height 440 if (UIDeviceOrientationIsPortrait([[UIDevice currentDevice] orientation])) { [scroll setContentSize:CGSizeMake(self.scroll.frame.size.width*numberOfPages,340)]; } else if (UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation])) { [scroll setFrame:CGRectMake(0,0,480,480)]; [scroll setContentSize:CGSizeMake(self.scroll.frame.size.width

detect changes to UIWebView's scroll view's contentSize

陌路散爱 提交于 2019-12-03 18:51:43
问题 I'm trying to set a UIView at the bottom of the content of a UIScrollView, do to so I set the view's position to the scrollview's contentsize height. But my scrollview is a subview of a UIWebView so when images are loaded, the contentsize height changes and my view which should be at the bottom of the scrollview ends up in the middle... So I am looking for a way to be notified when the scrollview's contentsize changes. I've tried to subclass it and change the setter for contentsize to send a

Preventing “wrapping” of items in UICollectionView

被刻印的时光 ゝ 提交于 2019-12-03 14:05:36
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.collectionView.contentSize = CGSizeMake((columns * (cellWidth + itemSpacingX), (rows * (cellHeight +

How to correctly get tableViewCell's contentView bound size?

怎甘沉沦 提交于 2019-12-02 18:09:32
问题 Resources: I've read multiple answers from Using Auto Layout in UITableView for dynamic cell layouts & variable row heights And followed their suggestions but it's not working. Setup to reproduce: If you copy/paste the MyTableViewCell and ViewController snippets: then you can reproduce the issue. I have subclassed MyTableViewCell and added my own label. import UIKit class MyTableViewCell: UITableViewCell { lazy var customLabel : UILabel = { let lbl = UILabel() lbl

How to correctly get tableViewCell's contentView bound size?

我的未来我决定 提交于 2019-12-02 10:11:23
Resources: I've read multiple answers from Using Auto Layout in UITableView for dynamic cell layouts & variable row heights And followed their suggestions but it's not working. Setup to reproduce: If you copy/paste the MyTableViewCell and ViewController snippets: then you can reproduce the issue. I have subclassed MyTableViewCell and added my own label. import UIKit class MyTableViewCell: UITableViewCell { lazy var customLabel : UILabel = { let lbl = UILabel() lbl.translatesAutoresizingMaskIntoConstraints = false lbl.numberOfLines = 0 return lbl }() override init(style: UITableViewCellStyle,

UIScrollView scroll not working after pushed with a navigation controller

戏子无情 提交于 2019-12-02 06:15:52
问题 I'm having an odd problem. I have a UIScrollView in a part of view hierarchy. It's working just fine when the view is presented via UITabBarController, but doesn't work at all after it is pushed with a Navigation controller (it is the third vc pushed atop the root). The scroll view was created in storyboard and the following lines are in the viewDidAppear method: [super viewDidAppear:animated]; [self.scrollView setScrollEnabled:YES]; self.scrollView.contentSize = CGSizeMake(320.0f, 468.0f);

UIScrollView scroll not working after pushed with a navigation controller

青春壹個敷衍的年華 提交于 2019-12-01 23:51:47
I'm having an odd problem. I have a UIScrollView in a part of view hierarchy. It's working just fine when the view is presented via UITabBarController, but doesn't work at all after it is pushed with a Navigation controller (it is the third vc pushed atop the root). The scroll view was created in storyboard and the following lines are in the viewDidAppear method: [super viewDidAppear:animated]; [self.scrollView setScrollEnabled:YES]; self.scrollView.contentSize = CGSizeMake(320.0f, 468.0f); Any ideas, or suggestions? If you need shots of scrollview attributes inspector let me know. Here's the

Set minimum contentsize for UICollectionView

风格不统一 提交于 2019-12-01 07:31:27
I want to be able to set the minimum height of the content size within a UICollectionView, so I can hide/show a UISearchbar, similar to the way it's done on iBooks. However, I don't want to subclass the layout as I want to keep the standard vertical layout for a UICollectionView. any ideas? khangsile You can do this by subclassing UICollectionViewFlowLayout and overriding the method -(CGSize)collectionViewContentSize { //Get the collectionViewContentSize CGSize size = [super collectionViewContentSize]; if (size < minimumSize) return minimumSize; else return size; } Edit: I just realized you

Set minimum contentsize for UICollectionView

感情迁移 提交于 2019-12-01 05:25:48
问题 I want to be able to set the minimum height of the content size within a UICollectionView, so I can hide/show a UISearchbar, similar to the way it's done on iBooks. However, I don't want to subclass the layout as I want to keep the standard vertical layout for a UICollectionView. any ideas? 回答1: You can do this by subclassing UICollectionViewFlowLayout and overriding the method -(CGSize)collectionViewContentSize { //Get the collectionViewContentSize CGSize size = [super

detect changes to UIWebView's scroll view's contentSize

跟風遠走 提交于 2019-11-30 01:59:08
I'm trying to set a UIView at the bottom of the content of a UIScrollView, do to so I set the view's position to the scrollview's contentsize height. But my scrollview is a subview of a UIWebView so when images are loaded, the contentsize height changes and my view which should be at the bottom of the scrollview ends up in the middle... So I am looking for a way to be notified when the scrollview's contentsize changes. I've tried to subclass it and change the setter for contentsize to send a NSNotification: @implementation UIScrollView (Height) -(void)setContentSize:(CGSize)contentSize {