我有一個應用程序,我試圖在另一個字符串變量中附加一個字符串的值,然後在tableview的detailtextlabel中顯示該字符串變量。但我的查詢是我的字符串是沒有得到追加properly.What可能是issue.This是我的代碼:獲取將一個字符串的值附加到另一個字符串的問題iphone
-(void)viewWillDisappear:(BOOL)animated
{
repeatArray = [[NSMutableArray alloc] init];
repeatArray = [[NSUserDefaults standardUserDefaults]objectForKey:@"week"];
if (sun && mon && tue && wed && thu && fri && sat)
{
app.repeat [email protected]"Every day";
}
else if (mon && tue && wed && thu && fri && !sat && !sun)
{
app.repeat = @"Every Week days";
}
else if (sat && sun && !mon && !tue && !wed && !thu && !fri)
{
app.repeat = @"Every Weekends";
}
else if (sun || mon || tue || wed|| thu || fri || sat)
{
if (sun)
{
app.repeat = @"Every Sunday";
NSLog(@"weekday:%@",app.repeat);
}
if (mon)
{
app.repeat= @"Every Monday";
NSLog(@"weekday:%@",app.repeat);
}
if(tue)
{
app.repeat = @"Every Tuesday";
NSLog(@"weekday:%@",app.repeat);
}
if(wed)
{
app.repeat = @"Every Wednesday";
NSLog(@"weekday:%@",app.repeat);
}
if(thu)
{
app.repeat = @"Every Thursday";
NSLog(@"weekday:%@",app.repeat);
}
if(fri)
{
app.repeat = @"Every Friday";
NSLog(@"weekday:%@",app.repeat);
}
if(sat)
{
app.repeat = @"Every Saturday";
NSLog(@"weekday:%@",app.repeat);
}
}
}
所有這一切工作是好的。但我選擇週一週二和則僅顯示每個星期二。而是顯示「Every Mon,Tue」。
請幫我解決這個問題。
你怎麼想呢? **「每個星期一和每個星期二」**? – EmptyStack
@EmptyStack沒有選擇星期一和星期二我想要「Every Mo,Tue」 – Ajay
請在未來更好地設置你的問題。你的代碼很難閱讀。我爲你格式化了它。 –