iphone - StackScrollView issue with delegate ID MBProgressHUD -
i've got stack scroll view app (like twitter , facebook apps) using psstackedview
it's creates view stack:
appdelegate
// set root controller stack controller menurootcontroller *menucontroller = [[menurootcontroller alloc] init]; self.stackcontroller = [[psstackedviewcontroller alloc] initwithrootviewcontroller:menucontroller]; self.window.rootviewcontroller = self.stackcontroller; [self.window makekeyandvisible];
root nav controller has uitable, cell touch loads next view
// load home stories table psstackedviewcontroller *stackcontroller = xappdelegate.stackcontroller; uiviewcontroller*viewcontroller = nil; while ([stackcontroller.viewcontrollers count]) { //nslog(@"launchstories"); [stackcontroller popviewcontrolleranimated:yes]; } viewcontroller = [[testview alloc] initwithnibname:@"testview" bundle:nil]; ((testview *)viewcontroller).indexnumber = [stackcontroller.viewcontrollers count]; viewcontroller.view.width = roundf((self.view.width - stackcontroller.leftinset)/2); if (viewcontroller) { [xappdelegate.stackcontroller pushviewcontroller:viewcontroller fromviewcontroller:nil animated:yes]; }
in view want use mbprogresshud (https://github.com/matej/mbprogresshud/) display nice loading xml message
hud = [[mbprogresshud alloc] initwithview:self.view.window]; [self.view.window addsubview:hud]; hud.delegate = self ; hud.labeltext = @"loading"; [hud showwhileexecuting:@selector(mytask) ontarget:self withobject:nil animated:yes];
but
hud.delegate = self ;
throws warning , app crashes
assigning 'id<mbprogresshuddelegate>' incompatible type 'testview *'
i've tried sorts of combinations try , find current controller no avail, can find width of current controller instance with
psstackedviewcontroller *stackcontroller = xappdelegate.stackcontroller; nslog(@"%f",stackcontroller.view.width);
which prints 748.000000. can't find work out 'self' should be.
any ideas?
testview needs implement mbprogresshuddelegate protocol. in testview.h make this:
@interface testview : classyouinheritfrom <mbprogresshuddelegate>
Comments
Post a Comment