<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>24Days　iPhoeアプリはdelphiでいっとく &#187; iPhoneアプリ開発</title>
	<atom:link href="http://musecode.net/technote/?cat=6&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://musecode.net/technote</link>
	<description>24日でiPhoneアプリを開発・公開するまでの過程を実況するサイト</description>
	<lastBuildDate>Wed, 07 Sep 2016 03:25:20 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6</generator>
		<item>
		<title>Delphi XE7 で iOS 8.1.3 に対応</title>
		<link>http://musecode.net/technote/?p=821</link>
		<comments>http://musecode.net/technote/?p=821#comments</comments>
		<pubDate>Wed, 25 Feb 2015 04:39:56 +0000</pubDate>
		<dc:creator>kawabata</dc:creator>
				<category><![CDATA[delphi]]></category>
		<category><![CDATA[iPhoneアプリ開発]]></category>
		<category><![CDATA[申請手続き等]]></category>

		<guid isPermaLink="false">http://musecode.net/technote/?p=821</guid>
		<description><![CDATA[XE7 Update 1 をダウンロード、インストール http://cc.embarcadero.com/r [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>XE7 Update 1 をダウンロード、インストール</p>
<p>http://cc.embarcadero.com/reg/delphi</p>
<p>以下を確認</p>
<p>[配布用証明書]<br />
Mac 上で［キーチェーン アクセス］を開き、Developer（Distributionでない方）の方をダブルクリック。<br />
部署の部分が配布用証明書になる。</p>
<p>[モバイル プロビジョン プロファイル]<br />
[アプリ識別子]<br />
Mac にiPhone 構成ユーティリティ をインストールする。（ネットで検索、ダウンロード）iPhone 構成ユーティリティを起動、対象とするプロビジョニングプロファイル（ad-hocとStoreは別）を選択、下にあらわれるプロファイル識別子とアプリ識別子をメモ<br />
/Users/（ユーザー名）/Library/MobileDevice/Provisioning Profiles/（プロファイル識別子のメモの内容）.mobileprovision<br />
がモバイル プロビジョン プロファイルとなる。<br />
アプリ識別子はそのままアプリ識別子となる</p>
<p>プロジェクト＞オプション＞プロビジョニング<br />
と<br />
ツール＞オプション＞プロビジョニング<br />
に[配布用証明書]と[モバイル プロビジョン プロファイル]を入力。タイプ、モードが複数あるのですべてに設定。</p>
<p>delphiからファイル＞開く、%AppData%と入力してEnterキーを押す。<br />
Embarcadero\BDS\15.0\Entitlement.TemplateiOS<br />
を選択。</p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;!DOCTYPE plist PUBLIC &#8220;-//Apple//DTD PLIST 1.0//EN&#8221; &#8220;http://www.apple.com/DTDs/PropertyList-1.0.dtd&#8221;&gt;<br />
&lt;plist version=&#8221;1.0&#8243;&gt;<br />
&lt;dict&gt;<br />
&lt;%getTaskAllowKey%&gt;<br />
&lt;%applicationIdentifier%&gt;<br />
&lt;%pushNotificationKey%&gt;<br />
&lt;%keychainAccessGroups%&gt;<br />
&lt;/dict&gt;<br />
&lt;/plist&gt;</p>
<p>に二行を挿入<br />
&lt;key&gt;application-identifier&lt;/key&gt;<br />
&lt;string&gt;35XXXXXXXXX.com.rigXXXXX.XXXXXX&lt;/string&gt;<br />
[配布用証明書].[アプリ識別子]</p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;!DOCTYPE plist PUBLIC &#8220;-//Apple//DTD PLIST 1.0//EN&#8221; &#8220;http://www.apple.com/DTDs/PropertyList-1.0.dtd&#8221;&gt;<br />
&lt;plist version=&#8221;1.0&#8243;&gt;<br />
&lt;dict&gt;<br />
&lt;%getTaskAllowKey%&gt;<br />
&lt;key&gt;application-identifier&lt;/key&gt;<br />
&lt;string&gt;XXXXXXXXXX.com.XXXXXXXXX.XXXXXXXXX&lt;/string&gt;<br />
&lt;%applicationIdentifier%&gt;<br />
&lt;%pushNotificationKey%&gt;<br />
&lt;%keychainAccessGroups%&gt;<br />
&lt;/dict&gt;<br />
&lt;/plist&gt;</p>
<p>注意：<br />
<span style="color: #ff0000;"><strong>このファイルの行送りは、LF＋CR　でなくLFでなくてはいけないらしい。</strong></span><br />
結局TERA PADで読み込み改行コードをLFに変更した。</p>
<p>注意：<br />
目的フォルダ（release, debug）には、プロジェクトフォルダにある<br />
Entitlement.TemplateiOS<br />
をテンプレートにして、Entitlement.TemplateiOSが作成される。<br />
%AppData%下にあるEmbarcadero\BDS\15.0\Entitlement.TemplateiOS がプロジェクトフォルダにコピーされるのは初回起動時？のみ。よって、<span style="color: #ff0000;"><strong>Entitlement.TemplateiOSを検証するには、毎回、プロジェクトフォルダにある</strong></span><br />
<span style="color: #ff0000;"><strong> Entitlement.TemplateiOS</strong></span><br />
<span style="color: #ff0000;"><strong> を削除する必要がある。</strong></span></p>
<p>注意：<br />
アプリごとに[配布用証明書].[アプリ識別子]は違うが、上記の理由で、プロジェクトフォルダにあるEntitlement.TemplateiOS　を個々に書き換えることで対応できる。</p>
<p>インストールはMACからスクラッチディレクトリ<br />
/Users/yourname/RADPAServer/scratch-dir<br />
を開いて。そこにある、ipa ファイルを XCODE　organizer の目的機種のApplication にドラッグアンドドロップする。</p>
<p>参考：　<a href="http://blogs.embarcadero.com/sarinadupont/2015/01/29/ios-813-app-deployment-steps-for-xe7">http://blogs.embarcadero.com/sarinadupont/2015/01/29/ios-813-app-deployment-steps-for-xe7</a></p>
]]></content:encoded>
			<wfw:commentRss>http://musecode.net/technote/?feed=rss2&#038;p=821</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>テスト用実機の登録</title>
		<link>http://musecode.net/technote/?p=796</link>
		<comments>http://musecode.net/technote/?p=796#comments</comments>
		<pubDate>Sun, 22 Feb 2015 00:48:24 +0000</pubDate>
		<dc:creator>kawabata</dc:creator>
				<category><![CDATA[iPhoneアプリ開発]]></category>
		<category><![CDATA[申請手続き等]]></category>

		<guid isPermaLink="false">http://musecode.net/technote/?p=796</guid>
		<description><![CDATA[Certificates, Identifiers &#38; Profiles Device から UDID [&#8230;]]]></description>
				<content:encoded><![CDATA[<h1><a href="https://developer.apple.com/account/ios/device/deviceList.action">Certificates, Identifiers &amp; Profiles</a></h1>
<p>Device から</p>
<p>UDIDを聞かれるので　Mac に実機をUSB接続して iTune　を起動</p>
<p>概要を開く。UDIDはないが、シリアル番号をクリックすると表示される。右クリック、コピーでコピーできる</p>
]]></content:encoded>
			<wfw:commentRss>http://musecode.net/technote/?feed=rss2&#038;p=796</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TcomboBox コンボボックス TCombobox コンボボックスのまとめ</title>
		<link>http://musecode.net/technote/?p=661</link>
		<comments>http://musecode.net/technote/?p=661#comments</comments>
		<pubDate>Tue, 18 Mar 2014 01:09:21 +0000</pubDate>
		<dc:creator>kawabata</dc:creator>
				<category><![CDATA[delphi]]></category>
		<category><![CDATA[firemonkey]]></category>
		<category><![CDATA[iPhoneアプリ開発]]></category>

		<guid isPermaLink="false">http://musecode.net/technote/?p=661</guid>
		<description><![CDATA[ボックスアイテムのフォントサイズを設定 フォントと列挙 OnChange　のタイミング iOS では clea [&#8230;]]]></description>
				<content:encoded><![CDATA[<h2>ボックスアイテムのフォントサイズを設定</h2>
<pre class="brush: delphi; title: ; notranslate">
  for i := 0 to frmConfig.cmbDesignFontName.Count -1 do
  begin
    frmConfig.cmbDesignFontName.ListItems[i].StyledSettings := [];
    frmConfig.cmbDesignFontName.ListItems[i].Font.Size := 11;
  end;
</pre>
<h2>フォントと列挙</h2>
<pre class="brush: delphi; title: ; notranslate">

procedure TfrmMain.initFontCombo;
var
  tmpFileList: TstringList;
  i: Integer;
  DC:HDC;

  function EnumFamToLines(lplf: PLOGFONT; lpntm: PNEWTEXTMETRIC;
                            FontType: DWORD; Lines: LPARAM): Integer; stdcall;
  begin
    with lplf^ do
//      if    (lfCharSet = SHIFTJIS_CHARSET) and (lfPitchAndFamily and $0F = FIXED_PITCH) then
      // シフトJIS文字セット
      if    (lfCharSet = SHIFTJIS_CHARSET) then
        TStrings(Lines).Add(lplf.lfFaceName);
    Result := 1;
  end;

begin
  tmpFileList := TstringList.Create();
  DC := GetDC(0);
  tmpFileList.Clear;

  frmConfig.cmbDesignFontName.Items.Add(DEFAULT_DesignFontName);

  EnumFontFamilies(DC, nil, @EnumFamToLines, LongInt(tmpFileList));
  for i := 0 to tmpFileList.Count - 1 do
    if pos('@', tmpFileList[i]) = 0 then
      frmConfig.cmbDesignFontName.Items.Add(tmpFileList[i]);
  tmpFileList.Free;

  for i := 0 to frmConfig.cmbDesignFontName.Count -1 do
  begin
    frmConfig.cmbDesignFontName.ListItems[i].StyledSettings := [];
    frmConfig.cmbDesignFontName.ListItems[i].Font.Size := 11;
  end;

end;

</pre>
<h2>OnChange　のタイミング</h2>
<p>iOS では clear で OnChange イベントが発生する<br />
iOS では BeginUpdate、EndUpdate が無いとエラーが起こる可能性がある？</p>
<pre class="brush: delphi; title: ; notranslate">
  frmMain.cbxValueStep.BeginUpdate;
  frmMain.cbxValueStep.Items.Clear;
  for i := 0 to TValueStep.count - 1 do
  begin
    tmpValueStep.serial := i;
    ListBoxItem      := TListBoxItem.Create(frmMain.cbxValueStep);
    ListBoxItem.Tag  := tmpValueStep.serial;
    ListBoxItem.Text :=tmpWatchPair.pipToPriceStr(tmpValueStep.pip);
    frmMain.cbxValueStep.AddObject(ListBoxItem);
  end;

  frmMain.cbxValueStep.EndUpdate;

</pre>
]]></content:encoded>
			<wfw:commentRss>http://musecode.net/technote/?feed=rss2&#038;p=661</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Win32 とiOSの違い</title>
		<link>http://musecode.net/technote/?p=650</link>
		<comments>http://musecode.net/technote/?p=650#comments</comments>
		<pubDate>Tue, 28 Jan 2014 23:57:06 +0000</pubDate>
		<dc:creator>kawabata</dc:creator>
				<category><![CDATA[firemonkey]]></category>
		<category><![CDATA[iPhoneアプリ開発]]></category>

		<guid isPermaLink="false">http://musecode.net/technote/?p=650</guid>
		<description><![CDATA[iOS で TRectangle のThickness を 0 にするとエラー発生 iOS でコンボボックスの [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>iOS で TRectangle のThickness を 0 にするとエラー発生</p>
<p>iOS でコンボボックスのクリアで onChange イベントが発生</p>
<p>iOS では変数の初期化が自動的に行われていない。</p>
]]></content:encoded>
			<wfw:commentRss>http://musecode.net/technote/?feed=rss2&#038;p=650</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>アニメーション サンプル</title>
		<link>http://musecode.net/technote/?p=628</link>
		<comments>http://musecode.net/technote/?p=628#comments</comments>
		<pubDate>Mon, 18 Nov 2013 02:58:24 +0000</pubDate>
		<dc:creator>kawabata</dc:creator>
				<category><![CDATA[delphi]]></category>
		<category><![CDATA[iPhoneアプリ開発]]></category>
		<category><![CDATA[サンプルコード]]></category>

		<guid isPermaLink="false">http://musecode.net/technote/?p=628</guid>
		<description><![CDATA[]]></description>
				<content:encoded><![CDATA[<pre class="brush: delphi; title: ; notranslate">

unit untImageEffect;

interface

uses
  untImageManager,

  System.Classes,
  System.Types,
  System.UIConsts,
  FMX.Filter.Effects,
  FMX.Types,
  FMX.Controls,
  FMX.Objects;

type
  TCueMark = class(TObject)
private
  FParent: TImage;
  FCueImage: TImage;
  FPathAnimation: TPathAnimation;
  FRoughTimer: TTimer;
  FMSec: Integer;

  procedure OnRoughTimer(Sender: TObject);

  function getScreenHeight: Single;
  function getScreenWidth: Single;
  function getOrginHeight: Single;
  function getOrginWidth: Single;
  procedure OnPathAnimation1Finish(Sender: TObject);

  property ScreenWidth:  Single read getScreenWidth;
  property ScreenHeight: Single read getScreenHeight;
  property OrginWidth:   Single read getOrginWidth;
  property OrginHeight:  Single read getOrginHeight;

public
  constructor Create(aParent: TImage);
  destructor Destroy; override;

  procedure Start(aMSec: Integer);

end;

type
  TFloatingStars = class(TObject)
private
  FParent: TImage;
  FStarImage: Array of TImage;
  FPathAnimation: Array of TPathAnimation;
  FFillRGBEffect: Array of TFillRGBEffect;
//  FMSec: Integer;

  procedure setCount(const Value: Integer);

  procedure FreeAllImageAndPathAnimation();
    function getCount: Integer;
    function getScreenHeight: Single;
    function getScreenWidth: Single;
    function getOrginHeight: Single;
    function getOrginWidth: Single;
public
  constructor Create(aParent: TImage);
  destructor Destroy; override;

  procedure Start(aMSec: Integer);

  property ScreenWidth:  Single read getScreenWidth;
  property ScreenHeight: Single read getScreenHeight;
  property OrginWidth:   Single read getOrginWidth;
  property OrginHeight:  Single read getOrginHeight;

  property Count: Integer       read getCount        write setCount;

end;

var
  FloatingStars: TFloatingStars;
  CueMark: TCueMark;

implementation

uses
  untMainForm;

{ TFloatingStars }

constructor TFloatingStars.Create(aParent: TImage);
begin
//  inherited;
  FParent := aParent;
  Count  := 10;
end;

destructor TFloatingStars.Destroy;
begin
  FreeAllImageAndPathAnimation();
  inherited;
end;

procedure TFloatingStars.FreeAllImageAndPathAnimation;
var
  i: Integer;
begin
  //
  for i := 0 to Length(FStarImage) - 1 do
    FStarImage[i].Free;
  SetLength(FStarImage, 0);

  //
  for i := 0 to Length(FPathAnimation) - 1 do
//    if FPathAnimation[i] &lt;&gt; nil then FPathAnimation[i].Free;
  SetLength(FPathAnimation, 0);

  for i := 0 to Length(FFillRGBEffect) - 1 do
//    if FPathAnimation[i] &lt;&gt; nil then FPathAnimation[i].Free;
  SetLength(FFillRGBEffect, 0);

end;

function TFloatingStars.getCount: Integer;
begin
  Result := Length(FStarImage);
end;

function TFloatingStars.getOrginHeight: Single;
begin
  Result := FStarImage[0].Bitmap.Height;
end;

function TFloatingStars.getOrginWidth: Single;
begin
  Result := FStarImage[0].Bitmap.Width;
end;

function TFloatingStars.getScreenHeight: Single;
begin
  Result := FParent.Height;
end;

function TFloatingStars.getScreenWidth: Single;
begin
  Result := FParent.Width;
end;

procedure TFloatingStars.setCount(const Value: Integer);
var
  i: Integer;
begin

  FreeAllImageAndPathAnimation();

  SetLength(FStarImage,     Value);
  SetLength(FPathAnimation, Value);
  SetLength(FFillRGBEffect, Value);

  for i := 0 to Value - 1 do
  begin
    FStarImage[i] := TImage.Create(FParent);
    FStarImage[i].Parent := TFmxObject(FParent);
    FStarImage[i].Width  := 45;
    FStarImage[i].Height := 45;
//    FStarImage[i].Bitmap.SetSize(45,45);

    FStarImage[i].Bitmap.Assign(ImageManager.Item('star.png'));
    FStarImage[i].Position.X :=-100;
    FStarImage[i].Position.Y :=-100;
    FStarImage[i].Enabled := True;
    FStarImage[i].WrapMode := TImageWrapMode.iwFit;

    FStarImage[i].Visible := False;

    //
    FPathAnimation[i] := TPathAnimation.Create(FStarImage[i]);
    FPathAnimation[i].Parent := FStarImage[i];

    //
    FFillRGBEffect[i] := TFillRGBEffect.Create(FStarImage[i]);
    FFillRGBEffect[i].Parent := FStarImage[i];

    //    FPathAnimation[i].Parent := TFmxObject(FStarImage[i]);

  end;

end;

procedure TFloatingStars.Start(aMSec: Integer);
var
  i: Integer;
  tmpSize: Single;
  tmpDiff: Single;
  tmpDelay: Single;
  tmpDuration: Single;
  tmpStartPos: TPointF;
  tmpEndPos: TPointF;
begin

  for i := 0 to Count - 1 do
  begin

    tmpSize     := OrginWidth  * (Random + 0.5);
    tmpDiff     := Random * ScreenWidth * 0.5 + ScreenWidth/2;
    tmpDelay    := Random * (aMSec/1000) * 0.4;
    tmpDuration := Random * (aMSec/1000) * 0.6;

    tmpStartPos := PointF(tmpDiff,          -1 * tmpSize);
    tmpEndPos   := PointF( - ScreenWidth/2, ScreenHeight + tmpSize + 10);

    FStarImage[i].Width      := tmpSize;
    FStarImage[i].Height     := tmpSize;
    FStarImage[i].Position.X := tmpStartPos.X - FParent.Position.X;
    FStarImage[i].Position.Y := tmpStartPos.Y - FParent.Position.Y;

    FPathAnimation[i].Path.Clear;
    FPathAnimation[i].Path.MoveTo(PointF(0, 0));
    FPathAnimation[i].Path.LineTo(tmpEndPos);
//    FPathAnimation[i].Path.ClosePath;

    FPathAnimation[i].Loop := False;
    FPathAnimation[i].Duration := tmpDuration;
    FPathAnimation[i].Delay := tmpDelay;
    FPathAnimation[i].Interpolation := TInterpolationType.itQuadratic;

    case random(5) of
      0: FFillRGBEffect[i].Color := clapink;
      1: FFillRGBEffect[i].Color := claYellow;
      2: FFillRGBEffect[i].Color := claCyan;
      3: FFillRGBEffect[i].Color := claGreen;
      4: FFillRGBEffect[i].Color := claBlue;
    end;

    FStarImage[i].Visible := true;
    FPathAnimation[i].Start;

  end;

end;

{ TCueMark }

constructor TCueMark.Create(aParent: TImage);
begin

  FParent := aParent;

  FRoughTimer := TTimer.Create(nil);
  FRoughTimer.OnTimer  := OnRoughTimer;
  FRoughTimer.Enabled  := False;

  FCueImage := TImage.Create(FParent);
  FCueImage.Parent := TFmxObject(FParent);

  FCueImage.Bitmap.Assign(ImageManager.Item('cuemark.png'));
  FCueImage.Width      := FCueImage.Bitmap.Width;
  FCueImage.Height     := FCueImage.Bitmap.Height;
  FCueImage.Position.X := -100;
  FCueImage.Position.Y := -100;
  FCueImage.WrapMode := TImageWrapMode.iwFit;

  FCueImage.Visible := False;

  //
  FPathAnimation := TPathAnimation.Create(FCueImage);
  FPathAnimation.Parent := FCueImage;
  FPathAnimation.OnFinish  := OnPathAnimation1Finish;

end;

destructor TCueMark.Destroy;
begin
  FCueImage.Free;
//  FPathAnimation.Free;
  inherited;
end;

procedure TCueMark.OnPathAnimation1Finish(Sender: TObject);
begin
  FRoughTimer.Enabled := True;
end;

procedure TCueMark.OnRoughTimer(Sender: TObject);
begin
  FRoughTimer.Interval := FMsec div 2;
  FCueImage.Visible := False;
  FRoughTimer.Enabled := false;
end;

function TCueMark.getOrginHeight: Single;
begin
  Result := FCueImage.Bitmap.Height;
end;

function TCueMark.getOrginWidth: Single;
begin
  Result := FCueImage.Bitmap.Width;
end;

function TCueMark.getScreenHeight: Single;
begin
  Result := FParent.Height;
end;

function TCueMark.getScreenWidth: Single;
begin
  Result := FParent.Width;
end;

procedure TCueMark.Start(aMSec: Integer);
begin
    FMSec   := aMSec;

    FCueImage.Width      := OrginWidth;
    FCueImage.Height     := OrginHeight;

    FCueImage.Position.X := (ScreenWidth - OrginWidth) / 2;
    FCueImage.Position.Y := -1 * OrginHeight;

    FPathAnimation.Path.Clear;
    FPathAnimation.Path.MoveTo(PointF(0, 0));
    //
    FPathAnimation.Path.LineTo(PointF(0,
                                      (ScreenHeight - OrginHeight) / 2 + OrginHeight+40));
    FPathAnimation.Path.LineTo(PointF(0,
                                      (ScreenHeight - OrginHeight) / 2 + OrginHeight-40));
    FPathAnimation.Path.LineTo(PointF(0,
                                      (ScreenHeight - OrginHeight) / 2 + OrginHeight+20));
    FPathAnimation.Path.LineTo(PointF(0,
                                      (ScreenHeight - OrginHeight) / 2 + OrginHeight-20));
    FPathAnimation.Path.LineTo(PointF(0,
                                      (ScreenHeight - OrginHeight) / 2 + OrginHeight+5));
    FPathAnimation.Path.LineTo(PointF(0,
                                      (ScreenHeight - OrginHeight) / 2 + OrginHeight-5));
    FPathAnimation.Path.LineTo(PointF(0,
                                      (ScreenHeight - OrginHeight) / 2 + OrginHeight));
    FPathAnimation.Loop := False;
    FPathAnimation.Duration := FMsec / 2000;
    FPathAnimation.Delay := 0;
    FPathAnimation.Interpolation := TInterpolationType.itQuadratic;

    FCueImage.Visible := true;
    FPathAnimation.Start;

    end;

end.

</pre>
]]></content:encoded>
			<wfw:commentRss>http://musecode.net/technote/?feed=rss2&#038;p=628</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>24日目 +5　バイナリファイルの読み書き</title>
		<link>http://musecode.net/technote/?p=602</link>
		<comments>http://musecode.net/technote/?p=602#comments</comments>
		<pubDate>Fri, 27 Sep 2013 21:31:42 +0000</pubDate>
		<dc:creator>kawabata</dc:creator>
				<category><![CDATA[24Days Season2 FX練習ソフトを作成する]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[iPhoneアプリ開発]]></category>
		<category><![CDATA[サンプルコード]]></category>

		<guid isPermaLink="false">http://musecode.net/technote/?p=602</guid>
		<description><![CDATA[　これがないと実機ではエラーがでる FileMode := fmOpenRead ;]]></description>
				<content:encoded><![CDATA[<pre>　これがないと実機ではエラーがでる</pre>
<p>FileMode := fmOpenRead ;</p>
<pre class="brush: delphi; title: ; notranslate">

procedure THistoricalList.saveBinary(aFileName: String);

var
  i: integer;

  F: file of TOHLCRecord;
  tmpOHLCRecord: TOHLCRecord;
begin

  AssignFile(F, aFileName);
  ReWrite(F);

  // ファイルのヘッダー情報を open に書き込む
  tmpOHLCRecord.high  := 0;
  tmpOHLCRecord.low   := 0;
  tmpOHLCRecord.close := 0;
  // 0  THIS_PROGRAM_VERSION
  tmpOHLCRecord.open := THIS_PROGRAM_VERSION;
  Write(F, tmpOHLCRecord);
  // 1  Pair
  tmpOHLCRecord.open := Self.Pair.serial;
  Write(F, tmpOHLCRecord);
  // 2  timeStep
  tmpOHLCRecord.open := timeStep.serial;
  Write(F, tmpOHLCRecord);
  // 3  IsConsecutiveData
  tmpOHLCRecord.open := StrToInt(BoolToStr(Self.IsConsecutiveData));
  Write(F, tmpOHLCRecord);
  // 4  Count
  tmpOHLCRecord.open := Self.Count;
  Write(F, tmpOHLCRecord);

  for i := 5 to BINARYHEADER_COUNT - 1 do
  begin
    tmpOHLCRecord.open := -1;
    Write(F, tmpOHLCRecord);
  end;

  for i := 0 to self.Count - 1 do
  begin
    tmpOHLCRecord.IDateTimeValue := self.Items[i].IDateTime.Value;
    tmpOHLCRecord.open  := self.Items[i].PipOpen;
    tmpOHLCRecord.high  := self.Items[i].PipHigh;
    tmpOHLCRecord.low   := self.Items[i].PipLow;
    tmpOHLCRecord.close := self.Items[i].PipClose;
    Write(F, tmpOHLCRecord);
  end;

  CloseFile(F);
end;

procedure THistoricalList.loadBinary(aFileName: String);
var
  i: integer;

  F: file of TOHLCRecord;
  tmpOHLCRecord: TOHLCRecord;
  counter: Integer;
  tmpRecord: THistoricalRecord;

  tmpStartDateTimeValue: Integer;
  tmpEndDateTimeValue: Integer;
  tmpIsConsecutiveData: Boolean;
  tmpCounter: Integer;
begin

  AssignFile(F, aFileName);
  FileMode := fmOpenRead ;  //   
  Reset(F);

//  if tmpFlag then ShowMessage('Exists') else ShowMessage('NOT Exists');

  // 0  THIS_PROGRAM_VERSION
  Read(F, tmpOHLCRecord);
  // 1  Pair
  Read(F, tmpOHLCRecord);
  Self.pair.serial := tmpOHLCRecord.open;
  // 2  timeStep
  Read(F, tmpOHLCRecord);
  Self.TimeStep.serial := tmpOHLCRecord.open;
  // 3  IsConsecutiveData
  Read(F, tmpOHLCRecord);
  tmpIsConsecutiveData   := StrToBool(IntToStr(tmpOHLCRecord.open));
  // 4  Count
  Read(F, tmpOHLCRecord);
  tmpCounter := tmpOHLCRecord.open;

  // 空読み
  for i := 5 to BINARYHEADER_COUNT - 1 do
    Read(F, tmpOHLCRecord);

  SetLength(Self.Items, tmpCounter);

  for i := 0 to tmpCounter - 1 do
  begin
    Read(F, tmpOHLCRecord);
    tmpRecord.IDateTime.Value := tmpOHLCRecord.IDateTimeValue;
    tmpRecord.PipOpen  := tmpOHLCRecord.open;
    tmpRecord.PipHigh  := tmpOHLCRecord.high;
    tmpRecord.PipLow   := tmpOHLCRecord.low;
    tmpRecord.PipClose := tmpOHLCRecord.close;

    Self.Items[i].Assign(tmpRecord);
  end;

  CloseFile(F);

end;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://musecode.net/technote/?feed=rss2&#038;p=602</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>21日目 TImage Canvas への描画の基本</title>
		<link>http://musecode.net/technote/?p=565</link>
		<comments>http://musecode.net/technote/?p=565#comments</comments>
		<pubDate>Thu, 19 Sep 2013 21:11:31 +0000</pubDate>
		<dc:creator>kawabata</dc:creator>
				<category><![CDATA[24Days Season2 FX練習ソフトを作成する]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[iPhoneアプリ開発]]></category>
		<category><![CDATA[サンプルコード]]></category>

		<guid isPermaLink="false">http://musecode.net/technote/?p=565</guid>
		<description><![CDATA[]]></description>
				<content:encoded><![CDATA[<pre class="brush: delphi; title: ; notranslate">

  frmMain.imgLong.Bitmap.SetSize(Floor(frmMain.imgLong.Width),
                                 Floor(frmMain.imgLong.Height));


  with frmMain.imgLong.Bitmap.Canvas do
  begin
    BeginScene;

    Stroke.Kind := TBrushKind.bkSolid;
    Stroke.Color :=  claBlue;
    StrokeThickness := 4;

    Fill.Kind  := TBrushKind.bkSolid;
    Fill.Color := claAqua;

    FillRect(RectF(0 + 4,
                   0 + 4,
                   ScreenInfo.ButtonLongRect.Width - 4,
                   ScreenInfo.ButtonLongRect.Height - 4),
                   10,
                   10,
                   AllCorners,
                   1.0);

    DrawRect(RectF(0 + 4,
                   0 + 4,
                   ScreenInfo.ButtonLongRect.Width - 4,
                   ScreenInfo.ButtonLongRect.Height - 4),
                   10,
                   10,
                   AllCorners,
                   1.0);

    Fill.Color := claBlack;
    FillText(RectF(0 + 4,
                   0 + 4,
                   ScreenInfo.ButtonShortRect.Width - 4,
                   ScreenInfo.ButtonShortRect.Height - 4),
                   'SHORT',
                   False,
                   1.0,
                   [],
                   TTextAlign.taCenter);

    EndScene;
  end;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://musecode.net/technote/?feed=rss2&#038;p=565</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>17日目 サウンドマネージャー</title>
		<link>http://musecode.net/technote/?p=557</link>
		<comments>http://musecode.net/technote/?p=557#comments</comments>
		<pubDate>Sun, 15 Sep 2013 23:02:52 +0000</pubDate>
		<dc:creator>kawabata</dc:creator>
				<category><![CDATA[24Days Season2 FX練習ソフトを作成する]]></category>
		<category><![CDATA[iPhoneアプリ開発]]></category>
		<category><![CDATA[サンプルコード]]></category>

		<guid isPermaLink="false">http://musecode.net/technote/?p=557</guid>
		<description><![CDATA[]]></description>
				<content:encoded><![CDATA[<pre class="brush: delphi; title: ; notranslate">

unit untSoundManager10;

interface

uses
untFileNameInfo,

{$IFDEF IOS}
FMX.Media,
{$else}
MMSYSTEM,
{$ENDIF}

IOUtils,
SysUtils,
Classes,
Types;


type
TSoundManager = class
private

{$IFDEF IOS}
FMediaPlayer: TMediaPlayer;
{$else}
FMemoryStreamArray: Array of TMemoryStream;
{$ENDIF}

FNameArray: Array of String;
FPathName: String;

procedure setPathName(const Value: String);
procedure Stop;
public

constructor Create(aPathFileName: String);
destructor Destroy; override;

procedure Play(aItemName: String);
procedure Init();

property PathName: String write setPathName;
end;


implementation


procedure fileListOfFolder(aFolderName: string; vFileList: TStringList);
var
SearchPattern: string;
Option: TSearchOption;
FileNames: TStringDynArray;
FileName: string;
begin
// ファイル名に一致する検索パターン
SearchPattern := '*.*';

// ディレクトリの列挙モード
Option := TSearchOption.soTopDirectoryOnly; // トップレベル列挙モード
// Option := TSearchOption.soAllDirectories; // 再帰列挙モード

//指定のディレクトリ内のファイルのリスト
FileNames := TDirectory.GetFiles(aFolderName, SearchPattern, Option);
vFileList.Clear;
for FileName in FileNames do
vFileList.Add(TPath.GetFileName(FileName));

end;





{$IFDEF IOS}

// ---------------------------------------------------------------------------
//  For iOS
// ---------------------------------------------------------------------------

constructor TSoundManager.Create(aPathFileName: String);
begin
FMediaPlayer := TMediaPlayer.Create(nil);
PathName := aPathFileName;
end;

destructor TSoundManager.Destroy;
var
i: Integer;
begin

Init();
Stop();
FMediaPlayer.Free;

inherited;
end;


procedure TSoundManager.Init;
begin
SetLength(FNameArray, 0);
end;

procedure TSoundManager.Stop();
begin
FMediaPlayer.Stop;
end;



procedure TSoundManager.Play(aItemName: String);
var
i: Integer;
tmpPathFileName: String;
begin

Stop();

for i := Low(FNameArray) to High(FNameArray) do
if FNameArray[i] = Trim(aItemName) then
begin
tmpPathFileName  := FPathName + FNameArray[i] + '.mp3';
FMediaPlayer.FileName := tmpPathFileName;
FMediaPlayer.CurrentTime := 0;
FMediaPlayer.Play;
end;

end;


procedure TSoundManager.setPathName(const Value: String);
var
//  tmpPathName: String;
tmpFileList: TStringList;
i: Integer;
tmpPathFileName: String;
begin
Init();

FPathName := Value;
tmpFileList := TStringList.Create();

fileListOfFolder(FPathName, tmpFileList);

SetLength(FNameArray, 0);

for i := 0 to tmpFileList.Count - 1 do
if ((ExtractFileExt(tmpFileList[i]) = '.mp3') or
(ExtractFileExt(tmpFileList[i]) = '.mp3')) then
begin
SetLength(FNameArray, Length(FNameArray) + 1);
FNameArray[High(FNameArray)] := ChangeFileExt(ExtractFileName(tmpFileList[i]),'');
end;

tmpFileList.Free;
end;


{$else}


// ---------------------------------------------------------------------------
// - For Win
// ---------------------------------------------------------------------------


constructor TSoundManager.Create(aPathFileName: String);
begin
PathName := aPathFileName;
end;

destructor TSoundManager.Destroy;
var
i: Integer;
begin
Stop();
for i := 0 to Length(FMemoryStreamArray) - 1 do
FMemoryStreamArray[i].Free;

inherited;
end;


procedure TSoundManager.Stop();
begin
PlaySound(nil,0, SND_PURGE);
end;

procedure TSoundManager.Play(aItemName: String);
var
i: Integer;
begin

Stop();

for i := 0 to Length(FNameArray) - 1 do
if FNameArray[i] = Trim(aItemName) then
PlaySound(FMemoryStreamArray[i].Memory,
0,
SND_MEMORY or SND_ASYNC);

end;



procedure TSoundManager.setPathName(const Value: String);
var
//  tmpPathName: String;
tmpFileList: TStringList;
i: Integer;
tmpIndex: Integer;
tmpPathFileName: String;
begin
FPathName := Value;
//  tmpPathName := Value;
tmpFileList := TStringList.Create();

fileListOfFolder(FPathName, tmpFileList);

SetLength(FMemoryStreamArray, 0);
SetLength(FNameArray        , 0);

for i := 0 to tmpFileList.Count - 1 do
if ((ExtractFileExt(tmpFileList[i]) = '.wav') or
(ExtractFileExt(tmpFileList[i]) = '.WAV')) then
begin
SetLength(FMemoryStreamArray, Length(FMemoryStreamArray) + 1);
SetLength(FNameArray        , Length(FNameArray)         + 1);

tmpIndex := Length(FMemoryStreamArray) - 1;

FMemoryStreamArray[tmpIndex] := TMemoryStream.Create();
tmpPathFileName := FPathName + tmpFileList[i];
FMemoryStreamArray[tmpIndex].LoadFromFile(tmpPathFileName);

FNameArray[tmpIndex] := ChangeFileExt(ExtractFileName(tmpFileList[i]),'');
end;

tmpFileList.Free;
end;

procedure TSoundManager.Init;
begin
SetLength(FMemoryStreamArray, 0);
end;

{$ENDIF}



end.


</pre>
]]></content:encoded>
			<wfw:commentRss>http://musecode.net/technote/?feed=rss2&#038;p=557</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>15日目 property に代入できない件</title>
		<link>http://musecode.net/technote/?p=551</link>
		<comments>http://musecode.net/technote/?p=551#comments</comments>
		<pubDate>Fri, 13 Sep 2013 23:37:37 +0000</pubDate>
		<dc:creator>kawabata</dc:creator>
				<category><![CDATA[24Days Season2 FX練習ソフトを作成する]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[iPhoneアプリ開発]]></category>

		<guid isPermaLink="false">http://musecode.net/technote/?p=551</guid>
		<description><![CDATA[config.HSTimeStep.Enum := ts1Hour; に代入しようとして、「代入できない左辺値 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>config.HSTimeStep.Enum := ts1Hour;</p>
<p>に代入しようとして、「代入できない左辺値です」的なエラーが出るとき、<br />
プロパティーの定義をチェックしてみると、</p>
<p>ダメパターン<br />
property Enum: TTimeStepEnum   read FEnum        write FEnum;</p>
<p>OKパターン<br />
property Enum: TTimeStepEnum   read FEnum        write setEnum;<br />
procedure TTimeStep.setEnum(const Value: TTimeStepEnum);<br />
begin<br />
FEnum := Value;<br />
end;</p>
<p>だった。</p>
]]></content:encoded>
			<wfw:commentRss>http://musecode.net/technote/?feed=rss2&#038;p=551</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>「DelphiによるiPhone / iPadアプリ開発コンテスト」にノミネートされた</title>
		<link>http://musecode.net/technote/?p=549</link>
		<comments>http://musecode.net/technote/?p=549#comments</comments>
		<pubDate>Thu, 12 Sep 2013 23:32:07 +0000</pubDate>
		<dc:creator>kawabata</dc:creator>
				<category><![CDATA[24Days Season1 初めてのiPhoneアプリ]]></category>
		<category><![CDATA[iPhoneアプリ開発]]></category>

		<guid isPermaLink="false">http://musecode.net/technote/?p=549</guid>
		<description><![CDATA[「DelphiによるiPhone / iPadアプリ開発コンテスト」にノミネートされた。 以下メール &#82 [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>「DelphiによるiPhone / iPadアプリ開発コンテスト」にノミネートされた。</p>
<p>以下メール</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
このたびは、「DelphiによるiPhone / iPadアプリ開発コンテスト」<br />
にご応募いただき誠にありがとうございます。</p>
<p>皆様からご応募いただきましたアプリについて厳正なる審査の結果、<br />
お客様の「らぶらぶ倫敦」が最終候補に残りました。最優秀賞の発表<br />
は、本日開催する「第26回 エンバカデロ・デベロッパーキャンプ」<br />
の【G6】セッションにて実施いたします。会場にお越しいただけない<br />
方は、Ustreamでライブ中継を視聴いただけます。ぜひご覧ください。</p>
<p>・デベロッパーキャンプ &#8211; ライブ中継<br />
⇒ <a href="http://www.embarcadero.com/jp/developer-camp-japan/live">http://www.embarcadero.com/jp/developer-camp-japan/live</a></p>
<p>以上、よろしくお願い致します。</p>
]]></content:encoded>
			<wfw:commentRss>http://musecode.net/technote/?feed=rss2&#038;p=549</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
