鉴于以下代码,按钮不会显示在工具栏上。有什么不对?
UIImagePickerController* cameraPickerController = [[UIImagePickerController alloc] init];
cameraPickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
cameraPickerController.delegate =self;
cameraPickerController.showsCameraControls = NO;
cameraPickerController.toolbarHidden = NO;
UIBarButtonItem *cancelBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered target: self action: @selector(cancel)];
UIBarButtonItem *flexibleBarSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
flexibleBarSpace.width = 1000;
UIBarButtonItem *cameraBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:cameraPickerController action:@selector(takePicture)];
UIBarButtonItem *faceBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"Show facemask" style:UIBarButtonItemStyleBordered target: self action: @selector(showFacemask)];
cameraPickerController.toolbar.items = [NSArray arrayWithObjects:cancelBarButtonItem,flexibleBarSpace,cameraBarButtonItem,flexibleBarSpace,faceBarButtonItem,nil];
[self presentModalViewController:cameraPickerController animated:YES];
理论上,那些 cancelBarButtons 和其他应该出现在工具栏上。但是,在这种情况下不会。请指教。