12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- //
- // NSMutableArray+proper.m
- // jiaPei
- //
- // Created by apple on 15/11/18.
- // Copyright (c) 2015年 JCZ. All rights reserved.
- //
- #import "MtArray+Setter.h"
- @implementation NSMutableArray(Setter)
- -(void)property:(id)obj forKey:(NSString*)key
- {
- if (self)
- {
- if (!obj) {
- obj = @"";
- }
- if (!key) {
- key = @"";
- }
- NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:obj,key, nil];
- [self addObject:dict];
- }
- }
- -(void)addPro:(NSString*)name Value:(NSString*)value
- {
- [self property:value forKey:name];
- }
- -(void)addHeader
- {
- }
- -(void)addFooter
- {
- [self addPro:@"isPage" Value:@""];
- [self addPro:@"pageSize" Value:@"100"];
- [self addPro:@"currentPage" Value:@"1"];
- }
- @end
- @implementation NSArray(Setter)
- -(id)objAtPath:(NSIndexPath*)path
- {
- if (path.section < self.count ) {
- NSArray* subObj = self[path.section];
- if([subObj isKindOfClass:[NSArray class]] ||
- [subObj isKindOfClass:[NSMutableArray class]])
- {
- if (path.row < subObj.count) {
- return [self[path.section] objectAtIndex:path.row];
- }
- }
- }
-
- return nil;
- }
- @end
|