So I’ve been meaning to do this post for a while. I’m just going to publish a whole lot of code snippets that I’ve found really useful and most of which I use on a daily basis. I hope you find them useful:
ACCESS THE APP DELEGATE FROM ANYWHERE
this one’s especially useful for throwing up a black overlay with a spinning loader or some such thing over the top of the whole app, just add it to the app delegate’s window.view and remove when done.
MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
CYCLE THROUGH ALL SUB VIEWS AND SET HIDDEN = YES
Just incase you want to switch everything off
- (void)setBackgroundToClearForView:(UIView *)view {
NSLog(@"CYCLING THROUGH SUB VIEWS 1");
if ([view subviews]) {
for (UIView *subView in [view subviews]) {
NSLog(@"CYCLING THROUGH SUB VIEWS 2");
[self setBackgroundToClearForView:subView];
}
}
if ([view respondsToSelector:@selector(setBackgroundColor:)]) {
[view performSelector:@selector(setBackgroundColor:)
withObject:[UIColor clearColor]];
}
}
VIEW DATA WRITTEN TO plist
NSDictionary *Data = [[NSDictionary alloc] initWithContentsOfFile:fullPath];
// dump the contents of the dictionary to the console
for (id key in Data) {
NSLog(@"bundle from file: key=%@, value=%@", key, [Data objectForKey:key]);
}
[Data release];