当单元格显示为灰色时触发LocalNotification

时间:2014-06-26 16:59:38

标签: objective-c uitableview boolean uilocalnotification nstimezone

这是一个在TableViewController中使用QuartzCore渲染单元格的方法....

- (void)grayOutCell:(CellGrayedOutTableViewCell *)cellGrayedOutCell {

if (cellGrayedOutCell) {
    dispatch_async(dispatch_get_main_queue(), ^{
        sightingsCell.contentView.alpha = 0.3f;
        CGRect oldFrame = cellGrayedOutCell.rssiImageView.frame;
        sightingsCell.rssiImageView.frame = CGRectMake(oldFrame.origin.x, oldFrame.origin.y, 0, oldFrame.size.height);
        cellGrayedOutCell.isGrayedOut = YES;
    });
}

}

以上所有代码均适用于表格视图。

当单元格显示为灰色时,我希望在AppDelegate.m文件中使用以下代码等待5秒后触发本地通知:

NSDate *AlarmTime = [[NSDate date] dateByAddingTimeInterval:5];
UIApplication *app = [UIApplication sharedApplication;
UILocalNotification *notifyAlert = [[UILocationNotification alloc] init];
if (notifyAlert) {
notifyAlert.fireDate = AlarmTime;
notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
notifyAlarm.repeatInterval = 0;
notifyAlarm.soundName = @"";
notifyAlarm.alertBody = @"Cell Grayed Out";
[app scheduleLocalNotification:notifyAlarm;
}

问题: 需要帮助以了解如何在TableViewController文件中链接BOOL“cellGrayedOutCell.isGrayedOut = YES;”以触发AppDelegate.m文件中的localNotification,以便在等待几秒后向用户发送本地通知。这将如何实现?谢谢!

0 个答案:

没有答案