iphone - Code is exectuting but the view is not loading when called form a function? -
i doing book kinda application using viewbased application. mainview acts backgroundview loading pages. each page different view , have own nib. when swipe on page(actually on mainview have loaded current view/page), page removed , next/previous page added.
[currentpage.view removefromsuperview]; [self.view insertsubview:nextpage.view atindex:0];
i have added popovercontroller barbutton in mainview. intialized tableviewcontroller class named popclass. popclass uitableviewcontroller class act parent popviewcontroller.
self.mypopcontroller = [[popcontroller alloc] initwithstyle:uitableviewstyleplain]; self.mypopovercontroller = [[uipopovercontroller alloc] initwithcontentviewcontroller:mypopcontroller];
when select row in popover, want backgroundview(mainview) load page corresponding number of row.
for have written function in bookview(mainview) controller class. , calling popover's parent class when select row.
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nsinteger topagenumber = indexpath.row + 1; [viewcontroller changetopage:topagenumber]; }
function , lines of code executing nothing happening. log lines printed no action takes place. code same removing page , adding page working when swipe view/page.
what problem? or there anyother way make view change in mainview using popover?
you need have refernce of background view controller in popover controller.
in popcontroller
controller should have delagate like:
@interface popcontroller: uitablviewcontroller{ //// other varibales; id delegate; } @property (nonatomic, retain) id delgate;
now class in showing popovercontroller
you should add line:
[mypopcontroller setdelegate:self];
then can acces method of main view controller class. using
[delegate calltherequiredmethod];
hope helps.
thanks,
madhup
Comments
Post a Comment