2012-02-17 78 views

答えて

3

バージョン、th task.probsPerDayの結果は完全に使用されず、%iは数字に置き換えずに、ラベルのテキストは「今日は何%問題ですか?」となります。

5

この行を::

probsPerDayLabel.text = @"Do %i problems today.",task.probsPerDay 

は次のようになります。あなたは

probsPerDayLabel.text = [NSString stringWithFormat:@"Do %i problems today.",task.probsPerDay]; 

あなたはこのように、NSStringstringWithFormat:方法を使用している必要があり

if(task.typeForThis.typeID == @"DivisionAT"){ 

    probsPerDayLabel.hidden = NO; 
    whatToDoLabel.hidden = YES; 
    //int ppdi = task.probsPerDay; 
    //NSString *ppd = [NSString stringWithFormat: @"%i", ppdi]; 
    probsPerDayLabel.text = @"Do %i problems today.",task.probsPerDay; //Right here 

} 
+0

@Joe:それは当てはまりません。ポインタエラーに変換された整数を取得します。私はXcodeで試したことがありません。 – grahamparks

+0

@Joe:いいえ、それは '(probsPerDayLabel.text = @"今日の%iの問題ですか? ")、task.probsPerDay;'と同じです。カンマは割り当てよりも優先順位が低くなります。 – grahamparks

+0

それは正しいです。終わりの金曜日、私は家に帰る必要があります! – Joe

関連する問題