Tips and Frequently Asked Questions
Adding an UIToolBarItem to the toolbar of an UITableView in iCL
The TTMSFMXNativeUITableView has a toolbar property that can be set to True. When adding an item, you can then add it to the TableViewController instead of the NavigationController. Below is the source code that demonstrates this.
unit UDemo; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, iOSApi.Foundation, FMX.TMSNativeUIBaseControl, FMX.TMSNativeUIView, FMX.TMSNativeUICore, FMX.TMSNativeUIViewController, FMX.TMSNativeUINavigationController, FMX.TMSNativeUIToolBar, MacApi.ObjectiveC, TypInfo, MacApi.ObjcRuntime, FMX.TMSNativeUITableView; type IUIToolBarButtonEventHandler = interface(NSObject) ['{1ACF3DFA-A90B-4F06-ACF1-8A40076BC9ED}'] procedure Click(Sender: Pointer); cdecl; end; TUIToolBarButtonEventHandler = class(TOCLocal) protected function GetObjectiveCClass: PTypeInfo; override; public procedure Click(Sender: Pointer); cdecl; end; TDemoForm = class(TForm) TMSFMXNativeUITableView1: TTMSFMXNativeUITableView; procedure FormCreate(Sender: TObject); private { Private declarations } FEventHandler: TUIToolBarButtonEventHandler; FHideButton: UIBarButtonItem; public { Public declarations } end; var DemoForm: TDemoForm; implementation {$R *.fmx} procedure TDemoForm.FormCreate(Sender: TObject); begin FEventHandler := TUIToolBarButtonEventHandler.Create; FHideButton := TUIBarButtonItem.Wrap(TUIBarButtonItem.Wrap(TUIBarButtonItem.OCClass.alloc).initWithBarButtonSystemItem(integer(siBarButtonSystemItemAdd), FEventHandler.GetObjectID, sel_getUid('Click:'))); TMSFMXNativeUITableView1.Options.ToolBar := True; TMSFMXNativeUITableView1.TableViewController.navigationItem.setRightBarButtonItem(FHideButton); end; { TUIToolBarButtonEventHandler } procedure TUIToolBarButtonEventHandler.Click(Sender: Pointer); begin ShowMessage('clicked'); end; function TUIToolBarButtonEventHandler.GetObjectiveCClass: PTypeInfo; begin Result := TypeInfo(IUIToolBarButtonEventHandler); end; end.
Pricing
Single Developer License
Small Team License
Site License
TMS iCL
€ 125
€
75
yearly renewal
license for 1 developer
BEST VALUE
All prices excl. VAT. Renewal price is subject to change and only valid up to 30 days after license has expired. After renewal period a discount price is offered to renew the license.