UITableViewをメニュー代わりにしてみる

ViewをLandscapeにすると、UITableViewが横に長くてなんだかもったいないなぁとか思っちゃう今日この頃ですがいかがおすごしですか?

Interface Builderをいじってて、UITableViewの幅を短くしてアニメーションと組み合わせればメニューのように使えるなぁと思ってちょろっとコード書いてみた。

絵的には以下のようになったんだけど、こういう使い方はありなのかしら。
たまには冒険するのもいいか。な。
な、な、な。

TableMenu

コード自体は大した事してないけど、UIViewの中にUITableViewを追加して、親のUIViewのポジションをUIViewのアニメーションでにゅるっと変化させる事で結構メニューっぽく見えるようになった。

- (IBAction)clickCloseMenuButton {
	CGRect frame = menuView.frame;
	frame.origin.x = -1.0 * frame.size.width;
	[UIView beginAnimations:nil context:nil];
	[UIView setAnimationDuration:0.3];
	menuView.frame = frame;
	[UIView commitAnimations];
}
 
- (IBAction)clickShowMenuButton {
	CGRect frame = menuView.frame;
	frame.origin.x = 0.0;
	[UIView beginAnimations:nil context:nil];
	[UIView setAnimationDuration:0.3];
	menuView.frame = frame;
	[UIView commitAnimations];
}

“UITableViewをメニュー代わりにしてみる” への1件のフィードバック

コメントは受け付けていません。