objective c - iOS: Methods of ViewController subclass not visible in other classes -
i'm trying develop iphone application. things working expect , prefer.
right issue i'm having when adding methods 1 of viewcontrollers methods not visible other parts of applications.
when add same methods, same signature other view controllers visible.
i've googled, browsed stackoverflow, reread, copy/pasted, , prayed spaghetti monster divine insight, no avail.
there must minor detail, in folly overlooking. hope able me!
infopageviewcontroller.h
#import <uikit/uikit.h> #import "db.h" @interface infopageviewcontroller : uiviewcontroller { iboutlet uiwebview* wv; db* db; } @property (retain, nonatomic) iboutlet uiwebview* wv; -(void) reloadinfopage; @end
infopageviewcontroller.m
#import "infopageviewcontroller.h" @interface infopageviewcontroller () @end @implementation infopageviewcontroller @synthesize wv; - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { self.title = nslocalizedstring(@"information", @"information"); self.tabbaritem.image = [uiimage imagenamed:@"tabicon-settings"]; db = [[db alloc] init]; // custom initialization } return self; } - (void)viewdidload { [super viewdidload]; // additional setup after loading view nib. dbinfopage* dbip = [db getinfopage]; [wv loadhtmlstring:dbip.html baseurl:nil]; //nslog(@"word%@", dbip.html); [self reloadinfopage]; } - (void)viewdidunload { [super viewdidunload]; // release retained subviews of main view. // e.g. self.myoutlet = nil; } - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return (interfaceorientation == uiinterfaceorientationportrait); } -(void)reloadinfopage { dbinfopage* dbip = [db getinfopage]; [wv loadhtmlstring:dbip.html baseurl:nil]; nslog(@"reloading infopage%@", @""); } @end
infoviewtest.h
#import <uikit/uikit.h> #import "infopageviewcontroller.h" @interface infoviewtest : nsobject @end
infoviewtest.m
#import "infoviewtest.h" @implementation infoviewtest -(void)test { infopageviewcontroller* ivc = [[infopageviewcontroller alloc] init]; [ivc reloadinfopage]; } @end
this yields error of "no visible @interface 'infopageviewcontroller' declares selector 'reloadinfopage'.
i have tried use autocomplete show me available methods of 'infopageviewcontroller', yields list not containing 'reloadinfopage', instance variable 'wv' not visible outside of scope of class.
i have tried closing , reopening xcode, restart computer. have tried 'clean' project.
any appreciated parts of hair, not yet pulled in frustration.
if have been lacking in providing information, please request , i'll best respond.
johan abildskov
actually code correct - have clean project , possibly restart xcode.
but optimize linking/compiling making modifications like:
infoviewtest.h
#import <uikit/uikit.h> //@class infopageviewcontroller; //add if you'll adding ivar or property of type @interface infoviewtest : nsobject @end
infoviewtest.m
#import "infoviewtest.h" #import "infopageviewcontroller.h" //here's place import other headers @implementation infoviewtest -(void)test { infopageviewcontroller* ivc = [[infopageviewcontroller alloc] init]; [ivc reloadinfopage]; } @end
edit: make sure implementation of db class correct. xcode error might lead wrong assumptions. again: code you've posted seems correct, not optimized compilation.
Comments
Post a Comment