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月 08
iPhone アプリで警告画面を表示させる方法です。
警告画面を表示する
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Alert Test"
message:@"Message!!\nThis is Alert Test."
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"One", @"Two", nil];
[alert show];
[alert release];
続きを読む »
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;
続きを読む »
12月 03
iPhone では NSXMLDocument がシュミレータでは動作するが実機では動作しないそうなので、NSXMLParser を使用して解析してみました。
解析したのは下記のような XML です。
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user name="hoge" age="20" />
<user name="fuga" age="30" />
</users>
続きを読む »
11月 26
※iPhone アプリを開発する勉強中です。自分用に勉強したときのメモです。
非公開API を使用していたためコードを改めました(2010.12.7)
現在時刻を取得する方法
NSTimer で1秒ごとに onTimer メソッドを呼び出し、UILabel clock の内容を更新する。
- (void)onTimer {
NSDate *now = [NSDate date];
[formatter setDateFormat:@"kk"];
int h = [[formatter stringFromDate:now] intValue];
[formatter setDateFormat:@"mm"];
int m = [[formatter stringFromDate:now] intValue];
[formatter setDateFormat:@"ss"];
int s = [[formatter stringFromDate:now] intValue];
clock.text = [NSString stringWithFormat:@"%02d:%02d:%02d", h, m, s];
}
- (void)viewDidLoad {
timer = [NSTimer scheduledTimerWithTimeInterval:(1.0) target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
}
10月 03
Release: CakePHP RC3 – The RC of Triumph! (Articles) | The Bakery, Everything CakePHP
RC3 はパフォーマンスが大幅に向上されているようです。
Over the past few weeks, Larry has worked tirelessly on iteration after iteration of performance improvements, and now we’re faster than ever before. By itself, the bootstrap process is over 10x faster than RC2, and basic requests for static content are now about 5x faster overall.
続きを読む »
9月 03
リビジョン間で更新のあったファイルの一覧を取得したいときの方法です。
例えばリビジョン100と101を比較したい場合は
$ svn diff -r 100:101 | diffstat
html/index.html | 126 +++
html/css/main.css | 90 ++
html/js/common.js | 2
3 files changed, 216 insertions(+), 2 deletions(-)
続きを読む »
Recent Comments