uiscrollview

Setting uiimage to nil doesn't release memory with ARC

99封情书 提交于 2019-12-12 07:19:28
问题 I have a scrollview that shows different images as it's scrolled through the pages, like PhotoScroller. I'm using ARC. When someone scrolls to another page, I set the image property of the UIImageView not being currently show to nil, as (attempting) to avoid memory crashes, which are still happening. Then when the user scrolls to a new page, the image for that page is set as the UIImageView's image property, as well as the page before and after it (for smooth viewing). The UIImage's for the

Getting a UIView's visible rectangle

房东的猫 提交于 2019-12-12 07:13:36
问题 I have a UIScrollView that contains a custom UIView . Inside the custom UIView , I'd like to know the rectangle in which it's visible (i.e. not clipped). The quick-n-dirty solution is to have the custom UIView assume that the parent is a UIScrollView and get the content size through it, but I'm looking for a better solution that doesn't involve make such assumptions. 回答1: This should do the trick CGRect visibleRect = CGRectIntersection(self.frame, superview.bounds); Use that in the UIView and

UIViewController viewWillAppear not called when adding as subView

匆匆过客 提交于 2019-12-12 07:07:28
问题 I have a UIViewController that I am loading from inside another view controller and then adding its view to a UIScrollView . self.statisticsController = [self.storyboard instantiateViewControllerWithIdentifier:@"StatisticsViewController"]; self.statisticsController.match = self.match; [self.scrollView addSubview:self.statisticsController.view]; I've put breakpoints in the statistics view controller and viewDidLoad is being called but viewWillAppear isn't. Is it because I'm not pushing it onto

Errors of key value observers and NSKVODeallocateBreak

南楼画角 提交于 2019-12-12 06:23:08
问题 I'm implementing a UITableView as a first level view controller that contains 5 table cells. Hitting on any of these cells will present a second level view. At the top left of this level view, there is a "back" button to return to the first level view. At the second level view, swiping left or right will show adjacent views continuously that link to those adjacent table cells at the first level view. After running, from first level view to second level view it's ok. But when hitting the "back

Stackview doesn't append second view

空扰寡人 提交于 2019-12-12 06:22:30
问题 I've created a stack view programmatically and I added a view which I've created programmatically too to it. But when I try to add a second view it doesn't work. Here's my code: @IBOutlet weak var codingScrollView: UIView! let codeStackView = UIStackView() var codeViews = [CodeView]() let codeView1 = CodeView(name: "Lennart", date: "13/05/2002", code: "Just some code") let codeView2 = CodeView(name: "Nina", date: "01/07/1999", code: "Also some code") The codingScrollView is the contentview I

how to use cancelPreviousPerformRequestsWithTarget

岁酱吖の 提交于 2019-12-12 06:12:31
问题 I have a method in scrollView:didScroll like this: [self.navigationCollectionView moveWhiteLineToPointX:middleX WithWidth:middleWidth animated:NO]; I don't want this method be called multiple times if user is scrolling fast, so I want to use +cancelPreviousPerformRequestsWithTarget:selector:object + (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget selector:(SEL)aSelector object:(id)anArgument I don't know how to feed the correct parameters for this API, especially for the target and

UIButton in non-visible area of UIScrollView

*爱你&永不变心* 提交于 2019-12-12 06:09:21
问题 How can I get a button tap for a button which is located in a UIScrollView, but in its initially non-visible area? Solved Problem was that the content was visible within a non-clipped view - therefore not getting touches. 回答1: I think you should add an action (yourAction in the code below) to the UIButton. programmatically: [button addTarget:self action:@selector(yourAction:) forControlEvents:UIControlEventTouchUpInside]; -(void)yourAction:(id)sender{ // your code } With the gui builder you

Pre-rendering, Pre-blending, CoreGraphics, CALayers?

别等时光非礼了梦想. 提交于 2019-12-12 06:06:24
问题 I have 200+ uiLabels added to a long (92000px) uiScrollView. I am getting the impression from some of the QAs that one option to improve performance is to pre-render the whole view into one? I basically add my uiLabels in a for loop inside ViewDidLoad to a scrollview. Could someone give me a few ideas for how you could go about rendering all those uilabels to a single layer? then add that layer to the uiScrollView? (I mention single Layer, I don't know anything about layers, I am just making

PagingEnabled for multiple pages in UIScrollView

▼魔方 西西 提交于 2019-12-12 06:01:29
问题 Edit: See the answer below. I finally give up and come here to ask you for my problem... I'm using a UIScrollView for a scrolling menus with little icons. On each page, with paging enabled, there's an icon in the center, and 2 and a half other visible icons on the left and right. I can move from one icon to its neighbour, and that is fine, but the point is that if I do a fast scrolling, it will not move from more than 3 icons, which is the width of the screen. What I would want is to be able

Touch Events in UIScroll View in iPhone

巧了我就是萌 提交于 2019-12-12 05:58:06
问题 I have created scroll view in my view controller and set the buttons in the scroll view. I have set the scroll view between the two images. The buttons are scrolling horizontally. Now i want to enable and disable the images. For Eg: Initially left images are to be hidden, once moving the button horizontally and enable right button and hidden the left button. How can i write the touch events for the scroll view?. - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@