私の質問は: 私は CustomCells を持っている TableVC を持っています。これらの customCells にはさまざまなラベルがあり、そのうちの 1 つが Time ラベルです。timeLabel のテキストは、xml の解析によって取得されます。しかし、今のところ、たとえば午後2時45分に静的コンテンツを使用したと仮定しています。このテキストを UILocalNotification の fireDate として指定することは可能ですか?もちろん、その時間に起動する必要があります。「didSelectRowAtIndexPath」にあるセルをクリックすると実行されます。それとも、これはできませんか??
はい、これが繰り返しの質問である場合、気に入らなかった場合、またはスペルミスや関連する何かがある場合は、反対票を投じないでください。私は過去に、人々がそのような安っぽい仕掛けをして、いわゆる評判を不健康で非専門的な方法で利用しているのを見てきました.
関連する回答を歓迎します。
ありがとうございました !!!
編集 私はこのことを試しました
NSString *str = cell.timeLabel.text;
NSLog(@"str = %@",str);
formatter = [[NSDateFormatter alloc]init];
[formatter setDateFormat:@"MM/dd/yyyy hh:mm a"];
NSTimeZone *gmt = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
[formatter setTimeZone:gmt];
date = [formatter dateFromString:str];
上記の cellForRowAtIndexPath
と
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = [NSDate dateWithTimeInterval:5 sinceDate:date];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.alertBody = @"You are notified";
localNotif.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication]scheduleLocalNotification:localNotif];
}