Toggling the Status Bar using an iOS FireMonkey application
Q: How do I turn on/off the Status Bar on the iPhone?
A: By calling setStatusBarHidden
Below, a simple unit that shows how to toggle the status bar using different animations - none, fade, and slide. The example also shows how to toggle the network activity indicator.
unit Unit1;
{$IFDEF FPC}
{$mode objfpc}{$H+}
{$modeswitch objectivec1}
{$ENDIF}interface
uses
SysUtils, Types, UITypes, Classes, Variants, FMX_Types, FMX_Controls, FMX_Forms,
FMX_Dialogs
{$IFDEF FPC}
, iPhoneAll
{$ENDIF}
;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
{$R *.lfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
{$IFDEF FPC}
UIApplication.sharedApplication.setStatusBarHidden(not UIApplication.sharedApplication.isStatusBarHidden);
{$ENDIF}
end;procedure TForm1.Button2Click(Sender: TObject);
begin
{$IFDEF FPC}
UIApplication.sharedApplication.setStatusBarHidden_withAnimation(not UIApplication.sharedApplication.isStatusBarHidden,UIStatusBarAnimationFade);
{$ENDIF}
end;procedure TForm1.Button3Click(Sender: TObject);
begin
{$IFDEF FPC}
UIApplication.sharedApplication.setStatusBarHidden_withAnimation(not UIApplication.sharedApplication.isStatusBarHidden,UIStatusBarAnimationSlide);
{$ENDIF}
end;procedure TForm1.Button4Click(Sender: TObject);
begin
{$IFDEF FPC}
UIApplication.sharedApplication.setNetworkActivityIndicatorVisible(not UIApplication.sharedApplication.isNetworkActivityIndicatorVisible);
{$ENDIF}
end;end.
February 12th, 2012 at 9:02 pm
How do fullscreen after the Hide Status Bar?
February 14th, 2012 at 6:25 am
I haven’t tried it yet. Things I would try include maximizing the form, changing the height and/or repositioning the form to the new top coordinates.
February 14th, 2012 at 6:58 pm
thank you
April 10th, 2012 at 6:44 am
Hi,
I try all methods to pom put the form in fullscreen but don’t reach to resize the form.
Any Idea ?
August 1st, 2012 at 11:19 am
Awesome! Please keep me posted!