Last active
August 29, 2015 14:02
-
-
Save sebastienwindal/f894508839d125dccf22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .h file | |
@interface LessonManager : NSObject | |
@property (strong, nonatomic) NSString * imageTitle; | |
+ (instancetype) sharedInstance; | |
@end | |
// .m mfile | |
@implementation LessonManager | |
+ (instancetype)sharedInstance | |
{ | |
// this whole thing ensures that this code is run once (at most), the plist parsing happens lazily, | |
// first time you call [LessonManager sharedInstance] | |
static dispatch_once_t once; | |
static id sharedInstance; | |
dispatch_once(&once, ^{ | |
sharedInstance = [[self alloc] init]; | |
}); | |
return sharedInstance; | |
} | |
-(id) init | |
{ | |
self = [super init]; | |
if (self) { | |
// this is your code I copied here from your email | |
NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"LessonContent1" ofType:@"plist"]]; | |
NSArray *arrayList = [NSArray arrayWithArray:[dictionary objectForKey:@"LessonOneArray"]]; | |
// Now a loop through Array to fetch single Item from catList which is Dictionary | |
[arrayList enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) { | |
self.imageTitle =[obj valueForKey:@"ImageName"]; | |
}]; | |
} | |
return self; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment