2013년 10월 17일 목요일

UILabel Auto Font Size Change

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, 768, 300)];
    label.font = [UIFont systemFontOfSize:50]; //表示フォントサイズ設定
    label.adjustsFontSizeToFitWidth = YES; //Autoshrink設定をYES
    label.numberOfLines = 2; //2行改行
    label.textAlignment = NSTextAlignmentCenter;//真ん中表示
    label.text = @"あああああああああああああああああああああああああああああああああああああああああああああああ";
    label.minimumScaleFactor = 0.5;//小さくするのをどこまでするかのスケール設定

    

    [_contentView addSubview:label];

2013년 10월 7일 월요일

縦向きの外部ディスプレイでiOSアプリ表示時、全画面にする方法

if ([[UIScreen screens] count] >1) { 
        //スクリーンが2つ以上存在する=外部ディスプレイ有り 
       UIScreen *secondScreen = [[UIScreen screens] objectAtIndex:1];
  secondScreen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame;   →全画面表示オプション     
       UIWindow *secondWindow = [[UIWindow alloc] initWithFrame:[secondScreen bounds]];        
       secondWindow.screen = secondScreen; 
       ViewForSub = [[UIView alloc] initWithFrame:[secondScreen bounds]]; 
       ViewForSub.backgroundColor = [UIColor blackColor];

       //以下、ViewForSubに必要なUI部品をaddSubviewしていく 
       //必要に応じて、ViewForMainにUILabel等を置いて「テレビ画面出力中」などと表示する 
   } else {    
       //外部ディスプレイ無し 
       (以下、ViewForMainに必要なUI部品をaddSubviewしていく)

   }

Youtubeから動画をダウンロードする方法(Chrome編)

****インストール手順(Chromeの場合・引用)****
>  1. 拡張機能ファイル(.crx) を右クリック→"名前を付けて保存"を選択
>  2. chrome://extensions/ を開く(アドレスバーに入力)
>  3. 1 でダウンロードしたファイルを 、2 のページにドラッグ・アンド・ドロップする