objective c - UnwindToList from IOS Tutorial does not activate -
i have followed "start developing ios apps today" tutorial.
the application has built expected. following block has not worked.
o link buttons unwindtolist: action
1) in project navigator, select main.storyboard.
2) on canvas, control-drag cancel button exit item in add-to-do-item scene dock.if don’t see exit item in scene dock instead see description of scene, click zoom in image: ../art/zoom_in_2x.png button on canvas until see it.a menu appears in location drag ended.
3) choose unwindtolist: shortcut menu.this action added xyztodolistviewcontroller.m file. means when cancel button tapped, segue unwind , method called.
4) on canvas, control-drag done button exit item in thexyzaddtodoitemviewcontroller scene dock.
5)choose unwindtolist: shortcut menu.
all other directions on tutorials have worked. build compiles without error. when app runs in simulator user clicks done or cancel, focus not move todolist scene. stays on add item screen.
any ideas on happening. ios 7.1
some further detail
this todocontroller.m unwindtolist
-(ibaction)unwindtolist:(uistoryboardsegue *)segue { ianno00004addtodoitemviewcontroller *source = [segue sourceviewcontroller]; ianno00004todoitem *item = source.todoitem; if (item != nil) { [self.todoitems addobject:item]; [self.tableview reloaddata]; } } **this todolistcontroller.h** @interface ianno00004todolistviewcontroller : uitableviewcontroller -(ibaction)unwindtolist:(uistoryboardsegue *)segue; @end
the addtoitemviewcontroller.m code #import "ianno00004addtodoitemviewcontroller.h"
@interface ianno00004addtodoitemviewcontroller () @property (weak, nonatomic) iboutlet uitextfield *textfield; @property (weak, nonatomic) iboutlet uibarbuttonitem *donebutton; @end @implementation ianno00004addtodoitemviewcontroller - (void) prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if (sender != self.donebutton) return; if (self.textfield.text.length > 0) { self.todoitem = [[ianno00004todoitem alloc] init]; self.todoitem.itemname = self.textfield.text; self.todoitem.completed = no; } }
you should add method unwindtolist in xyztodolisttableviewcontroller.h
(not itemviewcontroller, tableviewcontroller)
@interface xyztodolisttableviewcontroller : uitableviewcontroller -(ibaction)unwindtolist:(uistoryboardsegue *)segue; @end
then add following code in xyztodolisttableviewcontroller.m
- (ibaction)unwindtolist:(uistoryboardsegue *)segue { }
the tutorial used may old version, there might errors. follow latest version here: https://developer.apple.com/library/ios/referencelibrary/gettingstarted/roadmapios/secondtutorial.html#//apple_ref/doc/uid/tp40011343-ch8-sw7
Comments
Post a Comment