2014年4月27日日曜日

UITableViewのヘッダの背景色を変更する。

UITableViewを利用するとき、Viewを作るのは面倒だけど、背景色を変えたいという時が有ると思います。

そんな時はこのコード。


#pragma mark -
#pragma mark UITableViewDelegate method
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
    if(section == 0)
    {
        [view setTintColor:[UIColor orangeColor]];
    }
    else if(section == 1)
    {
        [view setTintColor:[UIColor greenColor]];
    }
}

サンプルとはいえ、色合いが。。。

2014年4月25日金曜日

【続報】アプリのアップロード時に「improper advertising identifier [IDFA] usage. your app contains the advertising identifier [IDFA] api but you have not indicated its usage on the prepare for upload page in itunes connect」というメッセージが出る

http://startup-objc.blogspot.com/2014/04/improper-advertising-identifier-idfa.html

以前の記事の続報です。

実はitunesconnectのアップ時の質問に以下の文章があります。

Advertising Identifier Does this app use the Advertising Identifier (IDFA)? The Advertising Identifier (IDFA) is a unique ID for each iOS device and is the only way to offer targeted ads. Users can choose to limit ad targeting on their iOS device.

これをNOと答えると、IDFA使ってませんと解釈されるので注意。

結果、利用したアプリはアップ時に弾かれます。

おまけに、アップしてもいないので、手動リジェクトが出来ません。

ぐぬる。

UINavigationControllerで自動表示される「前画面に戻る」的なボタンを非表示にする。

UINavigationControllerを利用していると(いえ、どんな場面でもあり得ますが)、時々前の画面に戻ってほしくない時があります。

表示が主なアプリなら良いのですが、「編集処理をしている途中に戻られると厄介」なんて事もあります。

そんな時に邪魔な「UINavigationControllerの戻るボタンを消す」のが以下のコード


 [[self navigationItem] setHidesBackButton:YES];


これでok


2014年4月10日木曜日

アプリのアップロード時に「improper advertising identifier [IDFA] usage. your app contains the advertising identifier [IDFA] api but you have not indicated its usage on the prepare for upload page in itunes connect」というメッセージが出る

アプリのアップロード時に以下のメッセージが表示される。

improper advertising identifier [IDFA] usage.
your app contains the advertising identifier [IDFA] api but you have not indicated its usage on the prepare for upload page in itunes connect
直訳
不適切な広告識別子[IDFA]使用法。 
あなたのアプリは、広告識別子[IDFA] APIが含まれていますが、あなたは接続iTunesのアップロードページの準備にその使用法を示していない。
itunes connetで毎回質問される英文の内容をよく読まないでチェックつけてサブミットしたせいかと思うけど、一回アップして手動リジェクトしないと確認出来ないので、よくわからない。
(そもそもアップが出来ないので・・・)

対応としては、AdSupportのフレームワークを外すと通ります。

調査不十分で申し訳ないですが取り急ぎ。


追記(2014-04-28)

続報です。
http://startup-objc.blogspot.jp/2014/04/improper-advertising-identifier-idfa_25.html

2014年3月8日土曜日

UIRefreshControl を使って引っぱり更新をする。

iOS6で追加された引っぱり更新用のUIRefreshControlですが、先日私事でiOS5の呪縛から逃れたのでメモメモ。

※ちなみにiOSの6と7ではUIのビジュアルが違いますが、個人的にはiOS6の方が好きですが、手元に環境がないのでこの例はiOS7です。

UITableViewControllerにrefreshControlのプロパティがあるので、画面の初期化の時に設定。
UIControlEventValueChangedでイベントが取得出来るので、その設定も忘れずに。

// リフレッシュコントロール
[self setRefreshControl:[[UIRefreshControl alloc] init]];
[[self refreshControl] addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];

イベントの受け取りメソッドも定義。


- (void)refresh:(UIRefreshControl *)control
{
    // 回転開始
    [[self refreshControl] beginRefreshing];
    
    //
    // 処理
    //
    
    // 回転終了
    [[self refreshControl] endRefreshing];
}

「beginRefreshing」と「endRefreshing」でインジケーターの回転のタイミングを調節できるので、これでやりたい処理を挟みます。


こんな感じ。

2014年3月7日金曜日

segmentedControlStyle でワーニングが出る

[[self _segmentedControl] setSegmentedControlStyle:UISegmentedControlStyleBar]; 
こんな指定をしているとiOS7から以下の様なワーニングが表示されます。
'UISegmentedControlStyleBar' is deprecated: first deprecated in iOS 7.0 - The segmentedControlStyle property no longer has any effect
ワーニング内容からもわかるように、 segmentedControlStyleにはもう何の効果も無いようです。

廃止されてしまいました。

代替のプロパティも無いようです。

iOS7専用アプリの場合は、指定を消してしまってかまわないようです。

2014年3月6日木曜日

XcodeでMissing fileというワーニングが出る

こんなやつです。

これはバージョン管理システムとの不整合で発生するのですが、
なんとも気持ちが悪い。

実際に、このワーニングが出たまま、アプリをAppStoreに申請しちゃってもなんの問題もないし、エラーの原因になる事も無いのですが、ワーニングが出ているだけで精神衛生上よくない。(私は)

なので、消します。

まず、ワーニングをクリックするとコピー出来ます。
これをコピーすると以下の様な文字列がとれます。
file:///Users/take/Desktop/Workspace/プロジェクト名/TableSummaryView.m: warning: Missing file: /Users/take/Desktop/Workspace/プロジェクト名/TableSummaryView.m is missing from working copy
これの前半の
file:///Users/take/Desktop/Workspace/プロジェクト名/TableSummaryView.m
の部分が必要になります。

この文字列の前にsvn rm をつけます。
あとfile://をとります。
svn rm /Users/take/Desktop/Workspace/プロジェクト名/TableSummaryView.m
これをターミナルに貼付けて実行!


これでok

ちょっと伏せ字が多くてすいません。