ios - Create plus button as push at runtime -
in tableviewcontroller
want create plus push button @ "run time" in viewdidload
of tableviewcontroller
trigger view.
i tried follows:
- (void)viewdidload { [super viewdidload]; // // create button in navigation // self.vc_addtodoitem = [[grf_vc_add_to_do_item alloc] init]; [self.navigationcontroller pushviewcontroller:self.vc_addtodoitem animated:no]; uibarbuttonitem *bt_plus = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target:self.vc_addtodoitem action:@selector(add:)]; self.navigationitem.rightbarbuttonitem = bt_plus; }
the result table view not displayed. instead view displayed link table view. if press link, table view displayed. if press plus button crash.
what problem?
update:
i added add method in grf_vc_add_to_do_item. crash gone. method add called. don't know in method show view, therefore method empty @ moment. if press "+" button, nothing happens. call necessary in add method display view grf_vc_add_to_do_item?
Comments
Post a Comment