iphonelazext: updating the example hello world project to be compatbile with the later iOS versions

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5044 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2016-07-29 03:31:34 +00:00
parent 48dab069a8
commit 43a1354fe2
2 changed files with 43 additions and 50 deletions

View File

@ -1,86 +1,63 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<Version Value="9"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<UseDefaultCompilerOptions Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Title Value="ihelloworld"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
<Language Value=""/>
<CharSet Value=""/>
<StringTable ProductVersion=""/>
</VersionInfo>
<CustomData Count="4">
<Item0 Name="iPhone/AppID" Value="com.mycompany.myapplication"/>
<Item1 Name="iPhone/SDK" Value="iPhone 2.0"/>
<Item2 Name="iPhone/SimSpaceName" Value="AE7A4C5E-559A-1694-53EF-3683CFE2F32D"/>
<Item3 Name="iPhone/isiPhoneApp" Value="true"/>
</CustomData>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="ihelloworld.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ihelloworld"/>
<CursorPos X="34" Y="12"/>
<TopLine Value="1"/>
<EditorIndex Value="0"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<SyntaxHighlighter Value="Delphi"/>
</Unit0>
</Units>
<JumpHistory Count="0" HistoryIndex="-1"/>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<Version Value="11"/>
<Target>
<Filename Value="ihelloworld"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/>
<Libraries Value="$Env(WNLIB)/../Music/oggvorbis/macosx/"/>
<OtherUnitFiles Value="MacLauncher/;$Env(WNLIB)/;$Env(WNLIB)/MacOS/;$Env(WNLIB)/Application2/;$Env(WNLIB)/Composite/;$Env(WNLIB)/Graphics/;$Env(WNLIB)/VectorGraphics/;$Env(WNLIB)/TextOut/;$Env(PTELIB)/;$Env(PTELIB)/3DBasics/;$Env(PTELIB)/3DEngine/;$Env(PTELIB)/DeviceMenu/;$Env(PTELIB)/DrawController/;$Env(PTELIB)/GdiEngine/;$Env(PTELIB)/NavPanel/;$Env(PTELIB)/PteClasses/;$Env(PTELIB)/PteViewer/;$Env(PTELIB)/Shaders/;$Env(PTELIB)/ShadowSpreads/;$Env(PTELIB)/VirtualList/;$Env(PTELIB)/OpenGL/;$Env(PTELIB)/MacOS/;$Env(WNLIB)/../Music/;$Env(WNLIB)/../Music/oggvorbis/"/>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
<CStyleOperator Value="False"/>
<IncludeAssertionCode Value="True"/>
<CPPInline Value="False"/>
<UseAnsiStrings Value="True"/>
</SyntaxOptions>
</Parsing>
<Linking>
<Debugging>
<UseLineInfoUnit Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<IgnoredMessages idx3018="True" idx3031="True" idx3189="True" idx4035="True" idx4036="True" idx4055="True" idx4079="True" idx4080="True" idx4081="True" idx5024="True" idx5057="True" idx5058="True" idx5060="True"/>
</CompilerMessages>
<CustomOptions Value="-XR/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk"/>
<CompilerPath Value="$(CompPath)"/>
<CustomOptions Value="-dIPHONEALL"/>
</Other>
</CompilerOptions>
<Debugging>

View File

@ -5,14 +5,17 @@ program ihelloworld;
{$linkframework UIKit}
uses
iPhoneAll, CGContext, CGGeometry, CFString;
// you can probably find a number of different iPhoneAll units available online.
// The example is written, using iPhoneAll from https://github.com/genericptr/iOS_8_0
// Once you get the headers don't forget to add to search path for the project
iPhoneAll;
type
TAppDelegate = objcclass(NSObject)
procedure applicationDidFinishLaunching(application: UIApplication); message 'applicationDidFinishLaunching:';
end;
TMyWindow = objcclass(UIWindow)
TMyView = objcclass(UIView)
public
procedure drawRect(c: CGRect); override;
end;
@ -21,7 +24,7 @@ const
helloworld = 'Hello world';
// window paint method
procedure TMyWindow.drawRect(c: CGRect);
procedure TMyView.drawRect(c: CGRect);
var
cg : CGContextRef;
begin
@ -45,18 +48,29 @@ begin
end;
var
mainwindow : TMyWindow;
mainwindow : UIWindow;
ctrl : UIViewController;
myview : TMyView;
{ TAppDelegate }
procedure TAppDelegate.applicationDidFinishLaunching(application: UIApplication);
begin
// application has initialized, now we can create the main window
mainwindow:=TMyWindow(TMyWindow.alloc);
// initialize window in Objective-C style
mainwindow := TMyWindow(mainwindow.initWithFrame (UIScreen.mainScreen.bounds));
mainwindow:=UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds);
// creating the root controller
ctrl:=UIViewController.alloc.init;
mainwindow.setRootViewController(ctrl);
myview := TMyView.alloc.init;
myview.setBounds( mainwindow.bounds );
ctrl.setView(myview);
// activate and show the window
mainwindow.makeKeyAndVisible;
end;
function NSStr(const s: string): NSString;
@ -68,11 +82,13 @@ end;
var
pool : NSAutoreleasePool;
{$R *.res}
begin
// initialize foundation memory manger (aka autorelease pool)
pool := NSAutoreleasePool.alloc.init;
// launching main application loop
ExitCode:=UIApplicationMain(argc, argv, nil, NSSTR('TAppDelegate'));
ExitCode:=UIApplicationMain(argc, PChar(argv), nil, NSSTR('TAppDelegate'));
// according to docs the UIApplicationMain never returns,
// but still the code present in the Obj-C main.m files
pool.release;