Delphi Seattle on iOS: Add a button to the NavigationBar of a Native UITableView

  

Using TTMSFMXNativeUITableView (from TMS iCL) I am trying to add a button to its toolbar (NavigationBar), preferably on the right side. I found many solutions how to do this in XCode, including this and this, but have not yet had success in doing this in Delphi.

Here is the most simplified edition of my code:

procedure TMyForm.FormCreate(Sender: TObject);
var lButtonItem: UIBarButtonItem;
begin
lButtonItem := TUIBarButtonItem.Wrap(TUIBarButtonItem.Wrap(TUIBarButtonItem.OCClass.alloc).initWithTitle(StrToNSStr(aText), integer(isBarButtonItemStylePlain), fToolBarEventHandler.GetObjectID, sel_getUid(‘Click:’)));
TMSFMXNativeUITableView1.NavigationController.navigationItem.setRightBarButtonItem(lButtonItem);

//also tried these combinations but with no success:
//TMSFMXNativeUITableView1.NavigationController.navigationItem.setLeftBarButtonItem(lButtonItem);
//TMSFMXNativeUITableView1.NavigationController.navigationItem.setBackBarButtonItem(lButtonItem);
//TMSFMXNativeUITableView1.TableViewController.NavigationController.navigationItem.setRightBarButtonItem(lButtonItem);
//TMSFMXNativeUITableView1.TableViewController.NavigationController.navigationItem.setLeftBarButtonItem(lButtonItem); //TMSFMXNativeUITableView1.TableViewController.NavigationController.navigationItem.setBackBarButtonItem(lButtonItem);
end;

What did I miss?

PS. I have not included my code for fToolBarEventHandler because it is not part of the current problem. I believe it could be replaced by NIL.

Comments are closed.