1

I am trying to make a tool bar appear (which works), once it appears I want to click the done button and dismiss the toolbar (does not work). I dont know how to go about this, I thought by removing pickerview that it will work. I think the biggest problem is my cancel rate method isnt being called.

     pickerView = [[UIView alloc]initWithFrame:CGRectMake(0, 300, 180, 260)];

     rateToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
     rateToolbar.barStyle = UIBarStyleBlackTranslucent;
     rateToolbar.items = [NSArray arrayWithObjects:
                       [[UIBarButtonItem alloc]initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:self action:@selector(cancelRate)],
                       [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],

                       nil];
    [rateToolbar sizeToFit];

    [pickerView addSubview:rateToolbar];   
    [self.view addSubview:pickerView];

  -(void)cancelRate{
  [pickerView removeFromSuperview];
   }
rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • Why don't you put an NSLog(@"Called"); in your cancelRate method and check if it is being called? – sbarow Jan 23 '14 at 19:46
  • I did, it isnt being called, but I dont know why. – user3228760 Jan 23 '14 at 19:48
  • I would suggest updating your question because your issue it the method not being called. http://stackoverflow.com/questions/2796438/uibarbuttonitem-target-action-not-working – sbarow Jan 23 '14 at 19:52

1 Answers1

0

This is how I do it ..

//PUT THIS CODE ON THE VIEWDIDLOAD EVENT
UIBarButtonItem *button2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(pressReloadButton)];
        self.navigationItem.rightBarButtonItem = button2;

//THIS IS THE METHOD THAT IS CALLED
- (void)pressReloadButton{
    self.spinner.hidden = NO;
    [self.spinner startAnimating];
    [self refresh];
}

hope it helps.. GL HF