Tuesday, October 4, 2011

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.

12 comments:

  1. How do fullscreen after the Hide Status Bar?

    ReplyDelete
  2. 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.

    ReplyDelete
  3. Hi,
    I try all methods to pom put the form in fullscreen but don't reach to resize the form.
    Any Idea ?

    ReplyDelete
  4. Awesome! Please keep me posted!

    ReplyDelete
  5. Hi there, how's it going? I recently mentioned this post along with a colleague, there was a fantastic chuckle.

    ReplyDelete
  6. The next test comes Saturday at Boston College. "I'm a competitor till the day I die," Winston said. "When he says I'm getting too aggressive, that means I'm making decisions off of emotions and not off of business. .
    [url=http://www.alpacatrack.com/images/Poslusznyjerseys.aspx?2]custom dallas cowboys jersey[/url]

    ReplyDelete
  7. Untracked snow in wide-open bowls, protected powder fields, and unlimited tree skiing lures skiers to high-mountain tours in the Centennials. The Nemesis Mountain Hut, named for the 9,449-foot Nemesis Mountain, is a custom-built shelter with two large wall tents. Skylights let in the Montana winter sun and provide views to Mt.

    ReplyDelete
  8. Remarkable! Its really amazing, I have got much clear idea on the topic of from this paragraph air Jordan shoes for sale[url=http://www.oops-uk.com/images/oops-ukjordans.asp]cheap jordan shoes[/url].
    wholesaleoutletcheapshoes http://wholesaleoutletcheapshoes.com/

    ReplyDelete
  9. Just like a large number of other mothers and fathers every year, I personally coached my three sons in sports activities. The call for you to duty appeared to be thrust in me in the beginning, but twenty five years later I personally hated clinging it up. To say I appreciated it is an exaggeration. Soccer Groundwork makes home equity loans field grants available to desperate schools. The earliest type, the area Grant, supplies funds to get schools to fit natural turf soccer career fields. The second sort, the Artificial Field Scholarhip, provides capital for educational institutions to install man-made soccer career fields indoors or outdoors.

    ReplyDelete
  10. nba shop coupon code (Yong) Seattle Seahawks Merchandise nfl shop promo code

    ReplyDelete
  11. Recomiendo adquirir en buyincoins y comprar este lector de tarjetas por el hecho de
    que es de una relación calidad costo genial.

    ReplyDelete

Note: Only a member of this blog may post a comment.