MtArray+Setter.m 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //
  2. // NSMutableArray+proper.m
  3. // jiaPei
  4. //
  5. // Created by apple on 15/11/18.
  6. // Copyright (c) 2015年 JCZ. All rights reserved.
  7. //
  8. #import "MtArray+Setter.h"
  9. @implementation NSMutableArray(Setter)
  10. -(void)property:(id)obj forKey:(NSString*)key
  11. {
  12. if (self)
  13. {
  14. if (!obj) {
  15. obj = @"";
  16. }
  17. if (!key) {
  18. key = @"";
  19. }
  20. NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:obj,key, nil];
  21. [self addObject:dict];
  22. }
  23. }
  24. -(void)addPro:(NSString*)name Value:(NSString*)value
  25. {
  26. [self property:value forKey:name];
  27. }
  28. -(void)addHeader
  29. {
  30. }
  31. -(void)addFooter
  32. {
  33. [self addPro:@"isPage" Value:@""];
  34. [self addPro:@"pageSize" Value:@"100"];
  35. [self addPro:@"currentPage" Value:@"1"];
  36. }
  37. @end
  38. @implementation NSArray(Setter)
  39. -(id)objAtPath:(NSIndexPath*)path
  40. {
  41. if (path.section < self.count ) {
  42. NSArray* subObj = self[path.section];
  43. if([subObj isKindOfClass:[NSArray class]] ||
  44. [subObj isKindOfClass:[NSMutableArray class]])
  45. {
  46. if (path.row < subObj.count) {
  47. return [self[path.section] objectAtIndex:path.row];
  48. }
  49. }
  50. }
  51. return nil;
  52. }
  53. @end