uiscrollview

Uitext Content SIze in UI Scroll View , the text in bottom is cut off

雨燕双飞 提交于 2019-12-10 21:22:42
问题 I have UIScroll that have uitextview inside it. My apps look like this: rootviewcontroller -> PhoneContentController ( UIScrollView and PageControl ) -> DetailController ( UITextView , UIWebView , UILabel ). My Flow is like this: Set UIScrollView default size -> call DetailController (calculate UITextView and other page inside it in viewDidLoad ) -> PhoneContentController get the total height size from DetailController -> Change the height of UIScrollView This is the code in

Getting ScrollView to Work with Autolayout and Storyboard

故事扮演 提交于 2019-12-10 20:28:49
问题 I am trying to make a really simple layout for an app I want to build - but I seem to be struggling with ScrollView and getting it to work via Storyboard. Basically I am trying to build below: I have done the constraints using several tutorials - but it either doesn't scroll or it looks wrong. Any suggestions? I am getting the following warning: 回答1: You have to provide the contentSize for a UIScrollView when laying it out using constraints. For example: You can set the width of View to be

setContentOffset on UIScrollView the right way

有些话、适合烂在心里 提交于 2019-12-10 20:27:51
问题 I'm using this code to scroll my UIScrollView down because I'm adding a new UIView on it from the bottom and I want to scroll down to it. I do it like this: CGPoint newOffset = CGPointMake(mainScrollView.contentOffset.x, mainScrollView.contentOffset.y + floorf(bottomAttachmentView.frame.size.height / bottomAttachmentView.multFactor)); [mainScrollView setContentOffset:newOffset animated:YES]; I basically add my new element's height to the y of UIScrollView 's contentOffset but sometimes it

iOS Paging Controls (Navigation)

一曲冷凌霜 提交于 2019-12-10 19:22:41
问题 Is there a way that I can use those paging dots independently in my app, add them to my UIView/NIB and call the functions on it to set total number of dots or current page/dot. Basically I've UIViewImage in a nib file, i'm displaying images (names taken off an array) on swipe gestures and want to show those paging dots on the bottom for the navigation information. 回答1: UIPageControl has it's total page & current page/dot just as you described, let's say pageControl is a instance of

Implement custom zooming for a UIScrollView

回眸只為那壹抹淺笑 提交于 2019-12-10 18:38:19
问题 I have a UIScrollView with the requirement that, when zooming, the contentSize.height should remain the same. Zooming in from 200x100 should result in a new contentSize of 400x100 instead of 400x200, for instance. I'd like to do my own drawing while the user is zooming. I don't think I can use the normal zooming behaviour of UIScrollView to achieve this, so I'm trying to roll my own. (I could just let it do its thing and then redraw my contents when -scrollViewDidEndZooming:withView:atScale:

UIVIew inside UIScrollView bounces back

血红的双手。 提交于 2019-12-10 18:26:14
问题 MY app is for iPad using Storyboards with two scenes. On one scene, I have a UIScrollView that contains a UIVIew. It scrolls, but bounces back immediately, rendering itself useless. The size of the UIScrollView is 768x590; the size of the UIView is 768x1590; ContentSize of the UIScrollView is 768x590. This is an image of the UIScrollView settings: (I have looked at SO and Google for the past 6 hours, tried a lot of stuff, but nothing works. I have also done a CMD + Option + K (Clean) several

Create a PDF file from a UIScrollView in Swift

坚强是说给别人听的谎言 提交于 2019-12-10 18:23:21
问题 I want to create a PDF file from the contents of a UIScrollView. func createPdfFromView(aView: UIView, saveToDocumentsWithFileName fileName: String) { let pdfData = NSMutableData() let height = 1754.0 let width = 1240.0 UIGraphicsBeginPDFContextToData(pdfData, CGRect(x:-30, y:15,width:width,height:height) , nil) UIGraphicsBeginPDFPage() guard let pdfContext = UIGraphicsGetCurrentContext() else { return } aView.layer.render(in: pdfContext) UIGraphicsEndPDFContext() if let documentDirectories =

How do I programmatically duplicate UIViews built in interface builder?

你。 提交于 2019-12-10 18:07:24
问题 I want to build up a sub-UIView in Interface Builder (contained within a UIScrollView) with some UILabels contained, I then want to programmatically "copy" this view adjust its left position (by multiples of its width) to achieve a "floating" left effect inside a UIScrollView. I then want to add this copied UIView back into the UIScrollView with different text for the UILabels. The problem is I don't know how and if you can "copy" UIViews. 回答1: You can try calling [view copy], but I wouldn't

UIView that follows UICollectionView indicator

▼魔方 西西 提交于 2019-12-10 17:50:06
问题 I want to create a custom UIView that contains a UIImageView and a UILabel, that points to the UICollectionView scroll indicator, and scrolls with it. i am using this code : - (void)scrollViewDidScroll:(UIScrollView *)scrollView { //get refrence of vertical indicator UIImageView *verticalIndicator = ((UIImageView *)[scrollView.subviews objectAtIndex:(scrollView.subviews.count-1)]); // get the relative position of the indicator in the main window CGPoint p = [verticalIndicator convertPoint

UIScrollView setContentSize crashes with uncaught NSRangeException

百般思念 提交于 2019-12-10 17:25:22
问题 Call to setContentSize crashes the application after some of the UIScrollView's contents have been removed. int toolbarHeight = [[[self navigationController] toolbar] frame].size.height; int navbarHeight = [[[self navigationController] navigationBar] frame].size.height; int totalHeight = toolbarHeight + navbarHeight; // contentWidth is 640 CGSize contentSize = CGSizeMake(contentWidth, [scrollView frame].size.height - totalHeight); [scrollView setContentSize:contentSize]; // Crash happens here