ios - no visible interface for QMBParallaxScrollViewController declare the selector viewControllerDidScroll -
this question had mentioned many time here question big , maybe not able whats wrong in code purpose asked question trying do mix between 2 library found on internet first 1 qmbparallaxscrollviewcontroller , second 1 m6parallaxcontroller stunning view controller going fine in 1 case in bottomviewcontroller in case scrollviewcontroller calling method when view scrolling need call method inside class scrollviewcontroller class contain :
#import "samplescrollviewcontroller.h" #import "qmbparallaxscrollviewcontroller.h" #import "uiviewcontroller+qmbparallaxscrollviewcontroller.h" @interface samplescrollviewcontroller (){ } @end @implementation samplescrollviewcontroller - (void)awakefromnib{ } - (void)scrollviewdidscroll:(uiscrollview *)scrollview { qmbparallaxscrollviewcontroller * parallaxcontroller = [self parallaxscrollviewcontroller]; [parallaxcontroller tableviewcontrollerdidscroll:self]; //here error } - (void)viewdidload { [super viewdidload]; } - (void)viewdidappear:(bool)animated{ [super viewdidappear:animated]; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } - (void)dealloc{ } #pragma mark - qmbparallaxscrollviewholder - (uiscrollview *)scrollviewforparallaxcontroller{ return self.scrollview; } - (ibaction)closebuttontouchupinside:(id)sender{ [self.parentviewcontroller dismissviewcontrolleranimated:yes completion:nil]; // close button } @end , inside qmbparallaxscrollviewcontroller contain this: // // qmbparallaxscrollviewcontroller.m // qmbparallaxscrollview-sample // // created toni möckel on 02.11.13. // copyright (c) 2013 toni möckel. rights reserved. // #import "qmbparallaxscrollviewcontroller.h" #import "mapviewcontroller.h" @interface qmbparallaxscrollviewcontroller (){ bool _isanimating; float _starttopheight; float _lastoffsety; } @property (nonatomic, strong) uiview *backgroundview; @property (nonatomic, strong) uiview *foregroundview; @property (nonatomic, strong) uiscrollview *backgroundscrollview; @property (nonatomic, strong) uiscrollview *foregroundscrollview; @property (nonatomic, strong) uitapgesturerecognizer *topviewgesturerecognizer; @property (nonatomic, strong) uitapgesturerecognizer *bottomviewgesturerecognizer; @property (nonatomic, strong) uiscrollview *parallaxscrollview; @property (nonatomic, assign) cgfloat currenttopheight; @property (nonatomic, strong, readwrite) uiviewcontroller * topviewcontroller; @property (nonatomic, strong, readwrite) uiviewcontroller<qmbparallaxscrollviewholder> * bottomviewcontroller; @property (nonatomic, assign, readwrite) cgfloat topheight; @property (nonatomic, assign, readwrite) cgfloat initialmaxheightborder; @property (nonatomic, assign, readwrite) cgfloat initialminheightborder; @property (nonatomic, readwrite) qmbparallaxstate state; @property (nonatomic, readwrite) qmbparallaxgesture lastgesture; @end @implementation qmbparallaxscrollviewcontroller - (void)viewdidload { [super viewdidload]; // additional setup after loading view. } - (void)dealloc{ if ([[_backgroundview gesturerecognizers] containsobject:self.topviewgesturerecognizer]){ [_backgroundview removegesturerecognizer:self.topviewgesturerecognizer]; } // remove observer if ([_foregroundview iskindofclass:[uiscrollview class]]){ uiscrollview *foregroundscrollview = (uiscrollview *)_foregroundview; [foregroundscrollview removeobserver:self forkeypath:@"contentsize"]; } [self.view removeobserver:self forkeypath:@"frame"]; } #pragma mark - qmbparallaxscrollviewcontroller methods - (void)setupwithtopviewcontroller:(uiviewcontroller *)topviewcontroller andtopheight:(cgfloat)height andbottomviewcontroller:(uiviewcontroller *)bottomviewcontroller{ self.topviewcontroller = topviewcontroller; self.bottomviewcontroller = bottomviewcontroller; _topheight = height; _starttopheight = _topheight; _maxheight = self.view.frame.size.height-50.0f; [self setmaxheightborder:max(1.5f*_topheight, 300.0f)]; [self setminheightborder:_maxheight-20.0f]; [self addchildviewcontroller:self.topviewcontroller]; _backgroundview = topviewcontroller.view; [_backgroundscrollview setautoresizingmask:uiviewautoresizingflexiblewidth]; [_backgroundview setclipstobounds:yes]; [self addchildviewcontroller:self.bottomviewcontroller]; _foregroundview = bottomviewcontroller.view; _foregroundscrollview = [uiscrollview new]; _foregroundscrollview.backgroundcolor = [uicolor clearcolor]; if ([self respondstoselector:@selector(toplayoutguide)]){ [self.foregroundscrollview setcontentinset:uiedgeinsetsmake(self.toplayoutguide.length, 0, self.bottomlayoutguide.length, 0)]; } _foregroundscrollview.delegate = self; [_foregroundscrollview setalwaysbouncevertical:yes]; _foregroundscrollview.frame = self.view.frame; _foregroundscrollview.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight; [_foregroundscrollview addsubview:_foregroundview]; [self.view addsubview:_foregroundscrollview]; [self.bottomviewcontroller didmovetoparentviewcontroller:self]; [self.view addsubview:_backgroundview]; [self.topviewcontroller didmovetoparentviewcontroller:self]; [self addgesturereconizer]; [self updateforegroundframe]; [self updatecontentoffset]; // if forground subview uiscrollview set kv-observer content size changes if ([_foregroundview iskindofclass:[uiscrollview class]]){ uiscrollview *foregroundscrollview = (uiscrollview *)_foregroundview; [foregroundscrollview addobserver:self forkeypath:@"contentsize" options:0 context:null]; } [self.view addobserver:self forkeypath:@"frame" options:0 context:null]; } #pragma mark - obersver -(void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void*)context { [self updateforegroundframe]; [self updatecontentoffset]; } #pragma mark - gestures -(void) addgesturereconizer{ self.topviewgesturerecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(handletap:)]; [self.topviewgesturerecognizer setnumberoftouchesrequired:1]; [self.topviewgesturerecognizer setnumberoftapsrequired:1]; [self.topviewcontroller.view setuserinteractionenabled:yes]; [self enabletapgesturetopview:yes]; } - (void)enabletapgesturetopview:(bool)enable{ if (enable) { [_backgroundview addgesturerecognizer:self.topviewgesturerecognizer]; }else { [_backgroundview removegesturerecognizer:self.topviewgesturerecognizer]; } } - (void) handletap:(id)sender { self.lastgesture = qmbparallaxgesturetopviewtap; nslog(@"hi"); [self showfulltopview: self.state != qmbparallaxstatefullsize]; } #pragma mark - nsobject overrides - (void)forwardinvocation:(nsinvocation *)aninvocation { if ([self.scrollviewdelegate respondstoselector:[aninvocation selector]]) { [aninvocation invokewithtarget:self.scrollviewdelegate]; } else { [super forwardinvocation:aninvocation]; } } - (bool)respondstoselector:(sel)aselector { return ([super respondstoselector:aselector] || [self.scrollviewdelegate respondstoselector:aselector]); } #pragma mark - uiscrollviewdelegate protocol methods - (void)scrollviewdidscroll:(uiscrollview *)scrollview { [self updatecontentoffset]; if ([self.scrollviewdelegate respondstoselector:_cmd]) { [self.scrollviewdelegate scrollviewdidscroll:scrollview]; } } - (void)scrollviewdidenddragging:(uiscrollview *)scrollview willdecelerate:(bool)decelerate{ if (!_isanimating && self.foregroundscrollview.contentoffset.y-_starttopheight > -_maxheightborder && self.state == qmbparallaxstatefullsize){ [self.foregroundscrollview setcontentoffset:cgpointmake(0, 0) animated:yes]; } } #pragma mark - public interface - (uiscrollview *)parallaxscrollview { return self.foregroundscrollview; } - (void)setbackgroundheight:(cgfloat)backgroundheight { _topheight = backgroundheight; [self updateforegroundframe]; [self updatecontentoffset]; } #pragma mark - internal methods - (cgrect)frameforobject:(id)frameobject { return frameobject == [nsnull null] ? cgrectnull : [frameobject cgrectvalue]; } #pragma mark parallax effect - (void)updateforegroundframe { if ([_foregroundview iskindofclass:[uiscrollview class]]){ _foregroundview.frame = cgrectmake(0.0f, _topheight, self.view.frame.size.width, max(((uiscrollview *)_foregroundview).contentsize.height,_foregroundview.frame.size.height)); cgsize size = cgsizemake(self.view.frame.size.width,max(((uiscrollview *)_foregroundview).contentsize.height,_foregroundview.frame.size.height) + _topheight); self.foregroundscrollview.contentsize = size; }else { self.foregroundview.frame = cgrectmake(0.0f, _topheight, self.foregroundview.frame.size.width, self.foregroundview.frame.size.height); self.foregroundscrollview.contentsize = cgsizemake(self.view.frame.size.width, self.foregroundview.frame.size.height + _topheight); } } - (void)updatecontentoffset { if (2*self.foregroundscrollview.contentoffset.y>_foregroundview.frame.origin.y){ [self.foregroundscrollview setshowsverticalscrollindicator:yes]; }else { [self.foregroundscrollview setshowsverticalscrollindicator:no]; } // determine if user scrolls or down if (self.foregroundscrollview.contentoffset.y > _lastoffsety){ self.lastgesture = qmbparallaxgesturescrollsup; }else { self.lastgesture = qmbparallaxgesturescrollsdown; } _lastoffsety = self.foregroundscrollview.contentoffset.y; self.backgroundview.frame = cgrectmake(0.0f,0.0f,self.view.frame.size.width,_topheight+(-1)*self.foregroundscrollview.contentoffset.y); [self.backgroundview layoutifneeded]; if (_isanimating){ return; } if (!_isanimating && self.lastgesture == qmbparallaxgesturescrollsdown && self.foregroundscrollview.contentoffset.y-_starttopheight < -_maxheightborder && self.state != qmbparallaxstatefullsize){ // [self showfulltopview:yes]; return; } if (!_isanimating && self.lastgesture == qmbparallaxgesturescrollsup && -_foregroundview.frame.origin.y + self.foregroundscrollview.contentoffset.y > -_minheightborder && self.state == qmbparallaxstatefullsize){ // [self showfulltopview:no]; return; } } - (void)tableviewcontrollerdidscroll:(uiviewcontroller *)viewcontroller { if (viewcontroller != self._viewcontroller) { return; } uiviewcontroller * tableview = self._viewcontroller; uiview * parallaxview = self.topviewcontroller.view; float y = tableview.view.frame.origin.y + self.topviewcontrollerstandartheight; cgrect currentparallaxframe = parallaxview.frame; if (y > 0) { cgfloat newheight = self.topviewcontrollerstandartheight - y; [parallaxview sethidden:(newheight <= 0)]; if (!parallaxview.hidden) { [self willchangeheightoftopviewcontrollerfromheight:parallaxview.frame.size.height toheight:newheight]; parallaxview.frame = cgrectmake(currentparallaxframe.origin.x, currentparallaxframe.origin.y, currentparallaxframe.size.width, newheight); } //uncomment if want support section headers - doesnt work 100% // if (y >= self.topviewcontrollerstandartheight) { // // tableview.contentinset = uiedgeinsetsmake(0, 0, 0, 0); // // } else { // // tableview.contentinset = uiedgeinsetsmake(self.topviewcontrollerstandartheight - y, 0, 0, 0); // // } } else { [parallaxview sethidden:no]; cgfloat newheight = self.topviewcontrollerstandartheight - y; [self willchangeheightoftopviewcontrollerfromheight:parallaxview.frame.size.height toheight:newheight]; parallaxview.frame = cgrectmake(currentparallaxframe.origin.x, currentparallaxframe.origin.y, currentparallaxframe.size.width, newheight); //uncomment if want support section headers - doesnt work 100% // tableview.contentinset = uiedgeinsetsmake(self.topviewcontrollerstandartheight, 0, 0, 0); } //[tableview setshowsverticalscrollindicator:parallaxview.hidden]; } - (void)willchangeheightoftopviewcontrollerfromheight:(cgfloat)oldheight toheight:(cgfloat)newheight { mapviewcontroller * topviewcontroller = (mapviewcontroller *)self.topviewcontroller; // [topviewcontroller willchan] [topviewcontroller willchangeheightfromheight:oldheight toheight:newheight]; float r = (self.topviewcontrollerstandartheight * 1.5f) / newheight; [self.bottomviewcontroller.view setalpha:r*r*r*r*r*r]; } - (void) showfulltopview:(bool)show { _isanimating = yes; [self.foregroundscrollview setscrollenabled:no]; [uiview animatewithduration:.3 delay:0.0 options:uiviewanimationoptioncurveeaseinout|uiviewkeyframeanimationoptionbeginfromcurrentstate|uiviewanimationoptionlayoutsubviews animations:^{ [self changetopheight:show ? _maxheight : _starttopheight]; } completion:^(bool finished){ _isanimating = no; [self.foregroundscrollview setscrollenabled:yes]; if (self.state == qmbparallaxstatefullsize){ self.state = qmbparallaxstatevisible; self.maxheightborder = self.initialmaxheightborder; } else { self.state = qmbparallaxstatefullsize; self.minheightborder = self.initialminheightborder; } if ([self.delegate respondstoselector:@selector(parallaxscrollviewcontroller:didchangestate:)]){ [self.delegate parallaxscrollviewcontroller:self didchangestate:self.state]; } }]; } - (void) changetopheight:(cgfloat) height{ _topheight = height; [self updatecontentoffset]; [self updateforegroundframe]; if ([self.delegate respondstoselector:@selector(parallaxscrollviewcontroller:didchangetopheight:)]){ [self.delegate parallaxscrollviewcontroller:self didchangetopheight:height]; } } #pragma mark - borders - (void)setmaxheightborder:(cgfloat)maxheightborder{ _maxheightborder = max(_topheight,maxheightborder); self.initialmaxheightborder = maxheightborder; } - (void)setminheightborder:(cgfloat)minheightborder{ _minheightborder = min(_maxheight,minheightborder); self.initialminheightborder = minheightborder; } @end
here links find on internet didn't me solve problem no visible @interface ____ declares selector no visible @interface book declares selector no visible @interface ____ declares selector no visible @interface declares selector errors no visible @interface 'xxx' declares selector
here message compiler :
Comments
Post a Comment