12月 16
iOS4.0 から使える Quick Look フレームワークを試してみました。
画像、PDF、HTML、iWorks、MSOffice などのファイルのプレビューをしたり、印刷やファイル形式によって対応している他のアプリで開いたりすることができます。
UITableViewController などと同じようにデータソースを指定して、プレビューさせるファイルがいくつあるか、indexPath で指定されたファイルのファイルパスを返すなどを実装すれば簡単にプレビュー画面を作成できます。
続きを読む »
12月 14
iPhoen アプリ内で Web ページを表示する方法です。UIWebView を使います。
UIWebViewを表示するためのシンプルなUIViewController – ちびり文
こちらのエントリを参考に IB を使ってやってみました。
続きを読む »
12月 10
iPhone を横方向に回転させた時に検知する方法のメモです。
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)FromInterfaceOrientation {
if(FromInterfaceOrientation == UIInterfaceOrientationPortrait){
// 横向き
} else {
// 縦向き
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
続きを読む »
12月 05
画面に表示された画像を指でドラッグする方法です。
UIImageView クラスを継承した DragView クラスを作成する。
@interface DragView : UIImageView {
CGPoint startLocation;
}
@end
@implementation DragView
- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
startLocation = [[touches anyObject] locationInView:self];
[[self superview] bringSubviewToFront:self];
}
- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
CGPoint pt = [[touches anyObject] locationInView:self];
CGRect frame = [self frame];
frame.origin.x += pt.x - startLocation.x;
frame.origin.y += pt.y - startLocation.y;
[self setFrame:frame];
}
@end;
続きを読む »
9月 06
OpenPNE のカスタマイズが多いので少しまとめておきます。
ディレクトリ構成
openpne/config.php コンフィグファイル
続きを読む »
7月 16
開発案件でアクション毎に SSL でのアクセスを必須にしたかったので調べていたところ下記の情報がありました。
SSL経由でのアクセスを必須にする[CakePHP] YARETOKO「ヤレトコ」メインブログ
早速 cake/cake/libs/controller/components/security.php のソースを確認して検証してみました。
続きを読む »
6月 15
CakePHP で SimpleTest を使うときにちょっとした小技の紹介です。
<?php
class UsersControllerTestCase extends CakeTestCase {
function startCase() {
echo '<h1>Starting Test Case</h1>';
}
function endCase() {
echo '<h1>Ending Test Case</h1>';
}
function startTest($method) {
echo '<h3>Starting method '.$method.'</h3>';
}
function endTest($method) {
echo '<hr/>';
}
function testIndex() {
$result = $this->testAction('/users/index');
debug($result);
}
}
?>
続きを読む »
6月 14
ある程度テストケースが増えてくるといちいち App Test Cases からひとつづつテストを実行するのは面倒です。そこでグループ化してまとめてテストケースを実行する方法です。
テストケースのグループ化
app/tests/groups 以下に GroupTest を継承したクラスを作成する。
GroupTest を継承したクラスのファイル名は hoge.group.php のように .group.php を付ける。
まとめる対象はディレクトリかファイルを指定できる。
続きを読む »
6月 13
CakePHP1.2 SimpleTest でテストケースを作成する ではモデルのテストケースを作成したので今度はコントローラのテストケースを作成してみました。
コントローラのテストケースは app/tests/case/conrollers 以下に作成します。
app/tests/case/conrollers/user_controller.test.php
<?php
class UsersControllerTestCase extends CakeTestCase {
function testIndexTitle() {
$result = $this->testAction('/users/index', array('return'=>'render'));
$this->assertPattern("/<title>TITLE<\/title>/", $result);
}
function testIndexSet() {
$result = $this->testAction('/users/index', array('return'=>'vars'));
$this->assertTrue(isset($result["users"]));
}
}
?>
続きを読む »
6月 03
New callback methods for components – cakebaker によると次にリリースされる CakePHP1.2 ではコンポーネントに3つのコールバック関数が追加されるようです。
beforeRender()
view のレンダリングの前、コントローラの beforeRender() メソッドの後に呼ばれる。
public function beforeRender($controller) {
}
続きを読む »
Recent Comments