ios - Storyboards and programmatically views -
i'm totally lost in issue. have been working storyboards, have created navigation controller tableviews , stuff. there services
in each row of tableview , need create 1 detail view each service.
there lot of services, can't create them in storyboard. idea download services
webservice (number of parameters, types of each one, etc..) , add textfields / buttons appropriate service
.
so, problems , questions are:
1) can combine storyboards , views programmatically? when create newview
in mytableviewclass
, should in prepareforsegue
method? how can show in screen without loosing navigation controller? have (it doesn't work: says me there no segue name 'service1' ) :
- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { nsindexpath *indexpath = [self.tableview indexpathforselectedrow]; if ([[segue identifier] isequaltostring:@"nextlevel"]) { [segue.destinationviewcontroller setactualnodo:[actualnodo getsonatindex:indexpath.row]]; } else if ([[segue identifier] isequaltostring:@"service1"]) { cgrect bounds = self.view.bounds; uiview *myview = [[uiview alloc] initwithframe:bounds]; [myview setbackgroundcolor: [uicolor redcolor]]; [self.view addsubview:myview]; [self.view bringsubviewtofront:myview]; }
any book or reference welcomed couldn't find similar. complicated in ios? have done similar thing in java. have read generating interfaces dynamically xibs but, sincerely, don't know is.. all.
yes can create storyboard
view , add views programmatically it.
you should not try creating view within prepareforsegue
method. should used passing objects viewcontroller
.
i suggest you. go storyboard
, create new uiviewcontroller scene. click on first scene , ctrl
drag new scene. next, click on segue , give name.
step 1:
create new class called servicesviewcontroller , make sure it's subclass of `uiviewcontroller:
step 2:
go storyboard
, click on scene selected. next, click on files owner
, click on class info button (the third button) , select serviceviewcontroller
class created.
step 3:
back in servicesviewcontroller
in didselectrowatindex
method call seque:
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { [self performseguewithidentifier:@"your_segue_name" sender:nil]; }
for now, clean out code in prepareforsegue
method , transition down first.
Comments
Post a Comment