Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I made TUSplitSyncScrollView like below images.</p> <p><img src="https://i.stack.imgur.com/plBWX.png" alt="enter image description here"> <img src="https://i.stack.imgur.com/2MCfp.png" alt="enter image description here"> <img src="https://i.stack.imgur.com/As7qi.png" alt="enter image description here"></p> <p>In this code, I used KVO for observing another window's behavior as below:</p> <pre><code>- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context; { if (keyPath == @"observedPresentScale") { // 自身のzoomScaleに監視しているobservedPresentScaleの値を代入する // まず拡大縮小可能にする self.maximumZoomScale = 1000.0; self.minimumZoomScale = 0.001; self.zoomScale = [change[@"new"] floatValue]; // ここで拡大縮小禁止にする self.maximumZoomScale = self.zoomScale; self.minimumZoomScale = self.zoomScale; printf("zoomScale = %f\n", self.zoomScale); } else if (keyPath == @"observedContentOffsetY") { self.contentOffset = CGPointMake(self.contentOffset.x, [change[@"new"] floatValue]); } } </code></pre> <p>And both two views observe each other.</p> <pre><code>int opt = NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew; // rightSplitedScrollViewをleftSplitedScrollViewのオブザーバにする [leftSplitedScrollView addObserver:rightSplitedScrollView forKeyPath:@"observedPresentScale" options:opt context:NULL]; [leftSplitedScrollView addObserver:rightSplitedScrollView forKeyPath:@"observedContentOffsetY" options:opt context:NULL]; // leftSplitedScrollViewをrightSplitedScrollViewのオブザーバにする [rightSplitedScrollView addObserver:leftSplitedScrollView forKeyPath:@"observedContentOffsetY" options:opt context:NULL]; // [rightSplitedScrollView addObserver:leftSplitedScrollView forKeyPath:@"observedPresentScale" options:opt context:NULL]; </code></pre> <p>You can run the actual project from here:<a href="https://github.com/weed/TUSplitSyncScrollView" rel="nofollow noreferrer">https://github.com/weed/TUSplitSyncScrollView</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload