uiscrollview

Clean autorotation transitions in a paging UIScrollView

时间秒杀一切 提交于 2019-12-17 18:25:05
问题 I have a paging UIScrollView in which the user pages horizontally through images, like Apple's Photos.app. That works, but now I'm trying to add rotation support. I've got the view rotating OK and have managed to set the contentSize, bounds, and subviews' frames properly to adapt to the different orientations. So before and after the rotation, everything is OK. However, the transitions themselves are awkward. The first image rotates perfectly, as if the axis of rotation is in the dead center

Programmatic UIScrollview with Autolayout

笑着哭i 提交于 2019-12-17 17:34:57
问题 After reading the technical notes on apple's website and reading matt neuburg's book on programming iOS 11 with a UIScrollview held in place with Autolayout, I have not been able to fully understand the concept of how it all works. Basically what I want to have is a Scrollview that would have a child view ChildView where this child view then has a Textview . Below I have attached the mockup of what I am trying to achieve Programmatically no-nibs, no storyboards. and as for the code, This is

iOS UIWebView inside a UIScrollView

佐手、 提交于 2019-12-17 17:26:31
问题 I want to have a UIWebView inside a UIScrollView . The UIWebView will sometimes go out of bounds of the iPhone screen so I need a way to scroll the view so I can see all the content (but I don't want to use the built in scrolling of the UIWebView). So I'm thinking of putting all the content inside of a UIScrollView and then making the height of the UIScrollView to equal the height of the UIWebView and other views that are in it. Here's an image to help describing my problem: 回答1: I did

Set UITableView content inset permanently

时光总嘲笑我的痴心妄想 提交于 2019-12-17 17:26:00
问题 In my app I have a UISearchBar under UINavigationBar so it is always visible to user. In that case I had to set contentInset with extra 44px so the UIScrollView will be scrolling under UISearchBar (exactly like in Contacts.app) . And there would be no problem with static UITableView 's but in my case I have to reload it's contents, switch to UISearchDisplayController etc. So when I call: [self.tableView setContentInset:UIEdgeInsetsMake(108, 0, 0, 0)]; Everything works until e.g. I pull to

UIScrollView pauses NSTimer while scrolling

自闭症网瘾萝莉.ら 提交于 2019-12-17 16:33:17
问题 I have a UIScrollView that has a series of labels which are rapidly updating numbers (every .06 seconds). While the scroll view is moving, however, the NSTimer is paused and does not continue until after the scrolling and the elastic animation have finished. How can I avoid this and have the NSTimer run regardless of the state of the scroll view? 回答1: An easy way to fix this is adding your NSTimer to the mainRunLoop . [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; To

Disable Magnifying Glass in UITextview

爱⌒轻易说出口 提交于 2019-12-17 16:27:45
问题 In UITextview when touch is pressed for the longer time magnifying glass shows up. How can i disable it. 回答1: Finally this issue is also resolved Here is the code for reference in case anyone needs in the m file of subclassed UITextview added code -(void)addGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer { //Prevent zooming but not panning if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) { gestureRecognizer.enabled = NO; } [super addGestureRecognizer

How to have a UIScrollView scroll and have a gesture recognizer?

只谈情不闲聊 提交于 2019-12-17 16:26:08
问题 I have a gesture recognizer on a UIScrollView, however it hardly ever gets called as the UIScrollView eats all the gestures. I partially got around this issue with this line: [scrollView.panGestureRecognizer requireGestureRecognizerToFail:rightSwipe]; however, this line results in my recognizer always being accepted (the desired behavior) and the scroll view not scrolling. That is, when you scroll, the recognizer is accepted but the view doesn't scroll. How can I get around this, or is there

How to embed a UITableView in a UIScrollview

泄露秘密 提交于 2019-12-17 15:42:46
问题 How can I do the following in a UIViewController (containing a tableview as a subview) I initially have a UIViewController showing a preview section (UIView) //Setup container for preview section UIView *tempContainer = [[UIView alloc]initWithFrame:CGRectMake(0, 20, 320, 100)]; self.preview_answer_container = tempContainer; self.preview_answer_container.backgroundColor = [UIColor clearColor]; [tempContainer release]; [self.view addSubview:self.preview_answer_container]; I also added a

Change page on UIScrollView

限于喜欢 提交于 2019-12-17 15:42:30
问题 I have a UIScrollView with 10 pages. I am able to flick between them. I also want to have 2 buttons (a back button and a next button) which when touched will go to the previous or next page. I can't seem to figure out a way to do this though. A lot of my code comes from Apple's page control sample code. Can anybody help? Thanks 回答1: You just tell the buttons to scroll to the page's location: CGRect frame = scrollView.frame; frame.origin.x = frame.size.width * pageNumberYouWantToGoTo; frame

UIImageView and UIScrollView zooming

偶尔善良 提交于 2019-12-17 15:29:50
问题 Do I actually need a UIPinchGestureRecognizer inside a UIScrollView to have the pinch working? If yes how do I do it? I am trying to implement what flipboard has, where it basically zooms in an image and have the scroll capability after zooming in. How do I do that? UPDATE: Here's some code that I have which doesn't call the scroll view delegate CGRect imgFrame; imgFrame.size.width = originalImageSize.width; imgFrame.size.height = originalImageSize.height; imgFrame.origin.x = imageOriginPoint