棘手的問題寫到這個主題。我想這是一個基本問題,但我似乎無法找到答案。 代碼本身就說明了我想做的事和的UILabel不顯示任何東西,第一行我添加到它工作正常,但不是當我嘗試寫出來的數組:UILabel沒有得到我寫給它的信息
-(IBAction)getSongHistory:(id)sender {
[historyLabel setText:@"test write\n test write another line"];
NSArray *pastMusicArray = [pastSongs getHistory];
for(int t=2; t<[pastMusicArray count]; t++) {
NSString *tempRow = [pastMusicArray objectAtIndex:t];
//NSLog(@"%@", tempRow);
[historyLabel setText:tempRow];
[historyLabel setText:@"\n"];
}
}
NSLog確實發佈了正確的東西。 這是什麼鑼,我沒有看到?
問題是setText替換了UILabel中的所有內容,因此我的最後一個setText是@「\ n」。這意味着一個空白的UILabel。 –
正是我所說的。 – fsaint