Native IOS control Delphi xe4

Source: Internet
Author: User

Used in the Delphi firemonkey platform is very large, and is well organized. of course button, alone firemonkey, and written. however, under certain circumstances in the OS the native control, because you will inevitably need to use a different API, about how to use the native control to learn.

//// Xe4 & IOS button example//// Http://blog.naver.com/simonsayz//// Ref.// Sampleniblessapp: http://rvelthuis.de/zips/sampleniblessapp.7z// Cr. nsalerthelper: http://code.google.com/p/delphi-foundations/// Delegate example: http://blogs.embarcadero.com/teamj/2013/05/09/3817/// Xe2, free Pascal: http://blog.naver.com/simonsayz/120162838290// Source to HTML: http://www.duketown.com/marcel/hyperdelphi.shtml//UnitUnit1;InterfaceUsesSystem. sysutils, system. types, system. uitypes, system. classes, system. variants, FMX. types, FMX. controls, FMX. forms, FMX. dialogs, FMX. stdctrls, FMX. platform. IOS, FMX. layouts, FMX. memo,//System. typinfo, macapi. objectivec, macapi. objcruntime, iosapi. cocoatypes, iosapi. Foundation, iosapi. uikit, iosapi. CoreGraphics;Type  //Ibtndelegate =Interface(Nsobject)ProcedureBtnpressed;Cdecl;End;//Tbtndelegate =Class(Toclocal)PrivateFinx: integer; fmemo: tmemo;Public   ConstructorCreate (random: integer; memo: tmemo );FunctionGetobjectivecclass: ptypeinfo;Override;ProcedureBtnpressed;Cdecl;End;//Tform1 =Class(Tform) button1: tbutton; memo1: tmemo;ProcedureButton1click (Sender: tobject );Private  PublicBtndelegate: tbtndelegate;End;VaRForm1: tform1;Implementation{$ R *. FMX}ConstructorTbtndelegate. Create (values: integer; memo: tmemo );Begin  InheritedCreate; self. finx: = 10; self. fmemo: = memo;End;FunctionTbtndelegate. getobjectivecclass: ptypeinfo;BeginResult: = typeinfo (ibtndelegate );End;//ProcedureTbtndelegate. btnpressed;BeginINC (finx); fmemo. lines. Add ('ios BTN pressed '+ inttostr (finx ));End;//ProcedureTform1.button1click (Sender: tobject );VaRBTN: uibutton;Begin //Memo1.lines. Add ('fmx BTN pressed ');//BTN: = tuibutton. Wrap (tuibutton. occlass. buttonwithtype (uibuttontyperoundedrect ));//BTN. setframe (cgrectmake (40,130,240,100); BTN. settitle (nsstr ('ios uibutton pressed '), uicontrolstatenormal );//Btndelegate: = tbtndelegate. Create (10, memo1 );//BTN. addtarget (btndelegate. getobjectid,// TargetSel_getuid ('btnpressed '),// ActionUicontroleventtouchdown );// Event //Define whandletoplatform (self. Handle). View. addsubview (BTN); // highlights !!! Cnsoft markEnd;End.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.