Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在另一个模型对象内对模型对象数组进行排序_Ios_Objective C_Sorting_Cocoa Touch_Nsarray - Fatal编程技术网

Ios 在另一个模型对象内对模型对象数组进行排序

Ios 在另一个模型对象内对模型对象数组进行排序,ios,objective-c,sorting,cocoa-touch,nsarray,Ios,Objective C,Sorting,Cocoa Touch,Nsarray,我有一个名为MYView的自定义对象数组。它包含一个名为通知的自定义对象数组。在Notification中,我有一个名为color的属性,它包含一个介于1和6之间的值。我需要根据以下条件对MYView对象数组进行排序 MYView的类结构 @interface MYView : NSObject @property (nonatomic) NSInteger viewID; @property (nonatomic)

我有一个名为
MYView
的自定义对象数组。它包含一个名为
通知
的自定义对象数组。在
Notification
中,我有一个名为
color
的属性,它包含一个介于1和6之间的值。我需要根据以下条件对
MYView
对象数组进行排序

MYView的类结构

@interface MYView : NSObject

@property (nonatomic)                      NSInteger viewID;

@property (nonatomic)                      NSInteger userId;

@property (readonly, strong, nonatomic)    NSString  *viewName;

@property (readonly, nonatomic, strong)    NSString  *viewCreaterName;

@property (readonly, nonatomic, strong)    NSArray *arrayOfNotifications; // This contains notification objects </i>
@接口MYView:NSObject
@属性(非原子)NSInteger viewID;
@属性(非原子)NSInteger用户ID;
@属性(只读、强、非原子)NSString*viewName;
@属性(只读、非原子、强)NSString*viewCreaterName;
@属性(只读、非原子、强)NSArray*arrayOfNotifications;//它包含通知对象
班级通知

@interface Notification : NSObject

@property (readonly, nonatomic) NSInteger sColorStatus; // This contains severity value. i.e 6,5..1. 
@property (readonly, nonatomic) NSInteger iNotificationID;

@property (readonly, nonatomic) NSString *warningName;

@property (readonly, nonatomic) NSString *warningIcon;

@property (readonly, nonatomic) NSArray  *rReplacementValuesArray;</i>
@接口通知:NSObject
@属性(只读,非原子)NSInteger sColorStatus;//它包含严重性值。i、 e 6,5..1。
@属性(只读,非原子)NSInteger iNotificationID;
@属性(只读,非原子)NSString*warningName;
@属性(只读,非原子)NSString*警告图标;
@属性(只读,非原子)NSArray*rReplacementValuesArray;
  • 警告的严重性。


    • 警告最严重的视图将列在顶部。

    • 其次,顺序基于严重警告的数量。如果多个视图具有严重警告,则具有最多严重警告的视图将位于列表顶部。

  • 通知数量


    • 虽然严重性优先于卷,但第二个排序参数基于通知的数量。

    • 如果多个视图在相同的严重性级别上具有相同数量的通知,则列表按字母顺序排列。

  • 阿尔法阶


    • 如果没有出现警告,列表将按字母顺序排列

  • 我曾多次尝试使用排序描述符实现,但未能满足所有条件。

    向我们展示您迄今为止的尝试。您应该在
    sortedarrayingcomparator:
    中使用自定义块比较器。