11月 10 2009

UIVIewをアニメーションさせる

Posted by dos in iphone, iphone Tips

UIViewアニメーションについて

[UIView beginAnimations:nil context:nil];

[UIView setAnimationDuration:0.6f];//アニメーションさせる時間

アニメーションさせたいUIViewの結果を記入します。

[UIView commitAnimations];

以上、このままですね〜。このままでOKです。ただし、

Read entire article.

11月 07 2009

日付と時刻の取得と、異なる書式対応

Posted by dos in iphone, iphone Tips

日付の取得を紹介していきたいと思います。

  • 日付と時刻を同じTextで表示させる

NSDate *date = [NSDate date]; // 現日時を生成

NSDateFormatter *dateForm = [[NSDateFormatter alloc] init]; // 生成と初期化

[dateForm setDateStyle: NSDateFormatterLongStyle]; // 日付のスタイルを設定

[dateForm setTimeStyle: NSDateFormatterLongStyle]; // 時刻のスタイルを設定

labelDate.text = [dateForm stringFromDate: date]; // 代入

[dateForm release];

スタイルを設定するぐらいでしょうか。

ほかにも下記に記述したように、日付と時刻を別々に取得する事も可能です。

Read entire article.

11月 04 2009

連続する番号の画像を配列に格納する

Posted by dos in iphone, iphone Tips

配列(NSMutableArray)に連続する番号の画像を

For文を使用して格納しようと思います。 

NSMutableArray *mutableArray = [[NSMutableArray alloc] init];
forint i =  1 ;   i <= 24 ;   i++ )
{
NSString *str = [NSString stringWithFormat:@”array_%d.png”, i ];
UIImage *img  = [UIImage imageNamedstr ];
if (img)[mutableArray addObject:img];
}

*i <= 24 は連続する番号の画像が24枚だった場合なのでその都度調整します。