我的应用有本地通知 . 它工作得很好 . 我使用表视图控制器,以显示活动通知 . 我面临的问题是,在表格视图单元格中,如果通知设置为重复或重复(即每小时,每天等),则不显示 .
显示有关每个通知的详细信息的表格单元格的代码如下:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString * CellIdentifier = @“TableCell”; TableCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
//获取本地通知列表
localNotifications = [[UIApplication sharedApplication] scheduledLocalNotifications]; UILocalNotification * localNotification = [localNotifications objectAtIndex:indexPath.row];
NSString * dateString = [NSDateFormatter localizedStringFromDate:localNotification.fireDate dateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterNoStyle]; NSString * timeString = [NSDateFormatter localizedStringFromDate:localNotification.fireDate dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle];
cell.TitleLabel.text = localNotification.alertBody; cell.DateLabel.text = dateString; cell.TimeLabel.text = timeString; cell.repeatStatus.text = localNotification.repeatInterval;
cell.textLabel.numberOfLines = 0;
返回细胞;
}
我尝试了很多东西,但没有任何结果 . 请帮忙 .
提前致谢 .