gpt4 book ai didi

ios - 按 dateTimeString 属性对 NSMutableArray 对象进行排序

转载 作者:行者123 更新时间:2023-11-29 13:02:06 25 4
gpt4 key购买 nike

<分区>

我是一名新程序员,我正在尝试使用每个具有 dateTimeString 属性的对象对 NSMutableArray 进行排序,我正在使用此数组在 TableView 上显示。

代码:

-(void)newAssignment:(AssignmentInfo *)assignment
{
[self.alist addObject:assignment];
NSString *filePath = [self dataFilePath];
[NSKeyedArchiver archiveRootObject:self.alist toFile:filePath];
[self.tableView reloadData];

}

- (IBAction)addTheInfo:(id)sender {

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
dateFormatter.timeZone = [NSTimeZone defaultTimeZone];
dateFormatter.timeStyle = NSDateFormatterShortStyle;
dateFormatter.dateStyle = NSDateFormatterShortStyle;
NSString *dateTimeString = [dateFormatter stringFromDate: dateTimePicker.date];
self.assignmentInfo.className = self.className.text;
self.assignmentInfo.assignmentTitle = self.assignmentTitle.text;
self.assignmentInfo.assignmentDescription = self.assignmentDescription.text;
self.assignmentInfo.dateTimeString = dateTimeString;

[self presentMessage:self.assignmentInfo.description];
[self dismissViewControllerAnimated:YES completion:nil];


[self.otherdelegate newAssignment:self.assignmentInfo];
NSLog(@"%@",self.otherdelegate);

if (self.edit) {
[self.otherdelegate deletedAssignment:self.assignmentEditing];
}


}

对象中的属性:

@property (nonatomic,strong)NSString *className;
@property (nonatomic,strong)NSString *assignmentDescription;
@property (nonatomic,strong)NSString *assignmentTitle;
@property (nonatomic,strong)NSString *dateTimeString;
@property (nonatomic)bool notifcationStatus;

我需要按日期时间字符串排序

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com