Tabs

iPhone&Androidのアプリ制作・デザイン

*

乱数のこと

      2014/11/02


乱数(ランダムな数)を取り出す際 rand や arc4random を使用しますが、何度も使うと取り出す数に偏りが出てきてしまいます。

randの例:
int randInt = rand() % 100;

arc4randomの例:
int randInt = arc4random() %100;

arc4random_uniformを使用することで偏りを軽減することができます。
以下 arc4random_uniform の参考

int randInt = arc4random_uniform(100);


 - Begin

  関連記事

no image
CheatSheet

Xcodeの便利なショートカットキー 良く使ってるなと感じたら追記 Cmd+Al …

no image
画面ローテーション

画面ローテーションを制御する場合は下記を追加する – (BOOL)s …

no image
NSLog まとめ

デバッグする時などに、ログを出力する方法としてNSLogを使用します。 文字列を …

eyechatch_xcode_tips-300x300
SNS連携

Twitter・Facebookとの連携は #import <Social …

no image
SubViewの重ね順を変更する

SubViewの重ね順を最前面に移動する場合 bringSubviewToFro …

eyechatch_xcode_tips-300x300
UIButton 同時押し制御

UIButton *myBtn = [UIButton alloc] init] …

no image
UIView

タイトル画面の背景など、新たにビューを追加した場合 UIViewを生成し sel …

no image
UIImageView 画像の差し替え

[UIImageView alloc] 後の画像を変換する時は下記コードを参照し …

no image
UIImageViewにボタンを貼りたい場合

タイトル画面などを作りたい場合、UIImageViewを使用して背景などを作るこ …

no image
ステータスバーを隠す方法

Deployment Info の Status Bar Style 下部にある …