Hi, guys!
I have a question about the nested scroll view.
A scroll view with nested scroll view. I just external-scrolling view and internal Scroldrishy will call the external scrollview horizontal scrollview, and inner scrollviews Vrtikl- scrollview Basically, if only one scroll view will be scrolled at the same time. If I scroll to left or top or down , internal scroll view will scroll, and, if I does diagonally scroll to speak, one scroll both Will be done . It depends on the direction of scrolling. if angle 0 ~ 45 Degree, the internal scroll view will be scrolled if the angle is 45 ~ 90 degrees, the outer-scroll view will be scrolled. Is it possible to change ANGLE ? For example, although the angle is 30 degrees, I want to scroll horizontally. Thank you! would appreciate any help :) You nested scrollview action If you want an easy way to get this way, you can try to disable horizontal scroll just for the sake of disabling vertical scrolling for internal view and external view. However, if he does not give you the result you are looking for, you will need to do a lot of custom coding. First of all, you have to start your sub-class of the UIC scroll view. Start by overwriting these tasks: and
- (zero) viewDidLoad {[Super ViewDidLoad] // Setup an additional after loading the view, usually from a nibb. _outerScrollView = [[UIScrollView alloc] initWithFrame: self.view.bounds]; _outerScrollView.pagingEnabled = YES; _oterskrollviavkkantentsize = Kgsizemake (_oterskrollviavkfremksaijkvidth * 3, _oterskrollviavkfremksaijkhait); [Self.view addSubview: _outerScrollView]; For (int i = 0; i & LT; 3; i ++) {UIScrollView * innerScrollView = [[UIScrollView alloc] initWithFrame: CGRectMake (i _outerScrollView.frame.size.width, 0, _outerScrollView.frame.size.width , _outerScrollView.frame * .size.height)]; [Add _outerScrollViewSubview: Interscrollview]; Uiviav * Kantentviav = [[Uiviav light] Initvitःfrme: Kgrektmke (0, 0, Inrskrollviavkfremksaijkvidth, Inrskrollviavkfremksaijkhait * 2.0)]; ContentView.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed: @ "imagefile"]]; [InnerScrollView adsview: contentView]; InnerScrollView.contentSize = contentView.frame.size; }}
touchesBegan: touchesMoved: touchesEnded: touchesCancelled:
touchesShouldBegin From there, you have to calculate your own to determine the angle of the drag and accordingly send a message to scrollview, possibly on a
super Calling or more than the above mentioned tasks, you can consider writing your own scrollwheel only with scroll, As a Updrishy of Rg can only be one UIView.
No comments:
Post a Comment