iPhone開発メモ アラートカスタム

このエントリをはてなブックマークに追加

アラートの枠サイズを変更する方法で少し悩んだのでメモ。

アラートの表示をカスタムしたい場合は、UIAlertViewを継承しsetFrameメソッドをオーバーライドしてサイズの変更をする。

- (void) setFrame:(CGRect)rect{
	[super setFrame:CGRectMake(0, 0, rect.size.width, 130)];
	self.center  = CGPointMake(320/2, 480/2);
}

こんな感じ。
ちなみに、下記メソッドを呼び出すことでもアラートを閉じる事が出来る。

[self dismissWithClickedButtonIndex:self.cancelButtonIndex animated:YES];

Category: 日記

Tagged:

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes