您的位置:首页 > 其它

7、8上的cell上的一个按钮,当点击按钮时,要拿到这个cell,可以用代理,也可以用superview

2015-07-31 11:20 477 查看
/** cell上的付款按钮事件 */
- (IBAction)paymentButtonClick:(UIButton *)sender {
/**
*  @author SongXing, 15-07-31 10:07:26
*
*  7、8系统上cell的父类关系不一致
*/
CPMyOrderVC_Cell *cell;
CGRect buttonRect = sender.frame;
for (CPMyOrderVC_Cell *c in [self.tableView visibleCells])
{
if (CGRectIntersectsRect(buttonRect, cell.frame))
{
cell = c;
}
}

NSIndexPath * path        = [self.tableView indexPathForCell:cell];
CPRouteOrderEntity *order = self.orders[path.row];

// 比较出发日期和当前日期
NSDateFormatter *fmt      = [[NSDateFormatter alloc] init];
fmt.dateFormat            = @"yyyy-MM-dd HH:mm:ss";
NSDate *orderStartTime    = [fmt dateFromString:order.start_time];
NSDate *now               = [NSDate date];
NSDateComponents *cmps    = [orderStartTime componentsToDate:now];

//过出发时间72小时可删除, 已付款可删除
if (cmps.month >= 1 || cmps.day >= 3 || cmps.hour >= 72)
{
kToastWithString(@"已超过出发时间72小时,不可以再支付了")
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: