AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Cross-Platform-Entwicklung UINavigationController mit UIImage und UITapGestureRecognizer
Thema durchsuchen
Ansicht
Themen-Optionen

UINavigationController mit UIImage und UITapGestureRecognizer

Ein Thema von Crocotronic · begonnen am 3. Feb 2014 · letzter Beitrag vom 5. Feb 2014
 
Crocotronic

Registriert seit: 9. Mai 2013
258 Beiträge
 
#1

UINavigationController mit UIImage und UITapGestureRecognizer

  Alt 3. Feb 2014, 13:48
Hallo,
meine App besitzt einen NavigationController mit einem Logo auf der linken Seite.
Wenn das Logo angeklickt wird, öffnent sich ein Menü (NavCont. wird nach rechts geschoben -> UIImage nicht mehr an gleicher Stelle).
Hier mal der Code:
Delphi-Quellcode:
procedure StyleNavBar(ANavigationController: TTMSFMXNativeUINavigationController; ALogoClickHandler: UITapGestureRecognizer; ATitle: String);
var nd: NSDictionary;
    background: UIView;
    navBarIcon: UIImageView;
    bgdRect: CGRect;
    imgRect: CGRect;
begin
 ANavigationController.Title:= ATitle;

 // Hintergrund
 bgdRect:= ANavigationController.NavigationController.navigationBar.frame;
 bgdRect.size.height:= bgdRect.size.height+Abs(MARGIN_TOP);
 bgdRect.origin.y:= MARGIN_TOP;

 background:= TUIView.Wrap(TUIView.Alloc.initWithFrame(bgdRect));
 background.setBackgroundColor(AlphaColorToUIColor($FF3E3894));

 // Logo
 navBarIcon:= TUIImageView.Wrap(TUIImageView.Alloc.initWithImage(ImageFromBitmap(BitmapContainer.Items[0].Bitmap)));

 imgRect:= navBarIcon.frame;
 imgRect.origin.x:= 5;
 imgRect.origin.y:= ((bgdRect.size.height/2)-(bgdRect.size.height/2))+Abs(MARGIN_TOP);

 navBarIcon.setUserInteractionEnabled(true);
 navBarIcon.setFrame(imgRect);
 navBarIcon.setContentMode(UIViewContentModeScaleAspectFit);
 if Assigned(ALogoClickHandler) then
  navBarIcon.addGestureRecognizer(ALogoClickHandler);

 // Zusammenführung
 background.addSubview(navBarIcon);
 ANavigationController.NavigationController.navigationBar.insertSubview(background,1);
 nd:= TNSDictionary.Wrap(TNSDictionary.OCClass.dictionaryWithObject((AlphaColorToUIColor($FFF1803C) as ILocalObject).GetObjectID, (NSForegroundColorAttributeName as ILocalObject).GetObjectID));
 ANavigationController.NavigationController.navigationBar.setTitleTextAttributes(nd);
end;
Anwendung:
StyleNavBar(MainView,TUITapGestureRecognizer.Wrap(TUITapGestureRecognizer.Alloc.initWithTarget(aClickHandler.GetObjectID,sel_getUid('Click'))),'Test');

Jetzt ergibt sich das Problem, dass der ClickHandler nicht mehr reagiert, wenn das Menü offen ist.
Erst wenn sich das Logo wieder an der alten Position befindet, wird der Klick erkannt.
Jemand eine Idee, woran das liegt?

Viele Grüße
Croco
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:13 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz