This is a very simple way to pass parameters between various views.
1st in the appDelegate.m file add;
// NSUserDefault setup for passing info around the app the starting default values.
[[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"list_filtered"];
[[NSUserDefaults standardUserDefaults] setInteger:1 forKey:@"selected_spreadsheet"];
[[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"selected_map_type"];
[[NSUserDefaults standardUserDefaults] setObject:@"ALL" forKey:@"selected_driver"];
[[NSUserDefaults standardUserDefaults] setObject:@"initialString" forKey:@"selected_plist"];
[[NSUserDefaults standardUserDefaults] setObject:@"initialDictionary" forKey:@"selected_member"];
[[NSUserDefaults standardUserDefaults] setObject:@"selectedIndexPath" forKey:@"selected_indexPath"];
// sync the defaults to disk
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
[[NSUserDefaults standardUserDefaults] synchronize];
Try the search, it's linked to some great forums
Friday, November 13, 2015
Thursday, November 5, 2015
Plist notes
For reading a Plist you need to;
// Loads file locally from either sheet
NSBundle *mainBundle = [NSBundle mainBundle];
NSURL *fileURL = [[NSURL alloc] init];
fileURL = [mainBundle URLForResource:@"SCWaveDistributionListCurrent" withExtension:@"plist"];
or just read Apple's docs N:
- URLForResource:withExtension:
Returns the file URL for the resource identified by the specified name and file extension. And I think it will read CSV files directly & with lots less hastle.
// Loads file locally from either sheet
NSBundle *mainBundle = [NSBundle mainBundle];
NSURL *fileURL = [[NSURL alloc] init];
fileURL = [mainBundle URLForResource:@"SCWaveDistributionListCurrent" withExtension:@"plist"];
or just read Apple's docs N:
- URLForResource:withExtension:
Returns the file URL for the resource identified by the specified name and file extension. And I think it will read CSV files directly & with lots less hastle.
Thursday, October 22, 2015
Pushing & Popping View Controllers
Pushing (adding to the stack) and Popping (removing from the stack) is a key technique for displaying your views on an iOS app. Doing this incorrectly can create huge memory leaks & crashes. Doing it properly can lead to beautiful transitions and navigation thru your app.
Here's some reference articles;
Back to Basics - View Controllers
Here is a code sample demonstrating how to push a view controller on to the navigation stack.
In this example, we instantiate a new UIViewController subclass
called MyViewController and push it on to the view controller stack.
One very important detail to point out is, you must do this from inside
of a view controller that is contained inside of a navigation
controller, otherwise the “self.navigationController” property will be
nil. navigationController is a property of every UIViewController
subclass that gets set whenever it has been inserted into a
UINavigationController.
Another thing to note is, we release the controller after pushing it on to the stack (prior to iOS5 with ARC). This is because the navigation controller will retain your view controller therefore preventing it from being released from memory.
The following code will pop the view controller off of the view stack with an animation.
Here's some reference articles;
Back to Basics - View Controllers
Here is a code sample demonstrating how to push a view controller on to the navigation stack.
// Initialize MyViewController object MyViewController *controller = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle]]; // Pushes MyViewController object on the navigation stack [self.navigationController pushViewController:controller animated:YES]; [controller release];
|
Another thing to note is, we release the controller after pushing it on to the stack (prior to iOS5 with ARC). This is because the navigation controller will retain your view controller therefore preventing it from being released from memory.
The following code will pop the view controller off of the view stack with an animation.
[self.navigationController popViewControllerAnimated:YES];
|
Saturday, October 10, 2015
Grid Nuetrality
A very compelling concept - In short, the grid will become less like a public water system and more
like the internet, a networked platform upon which all sorts of
innovations and markets can grow.
Based on this Vox article - http://www.vox.com/2015/10/9/9483803/grid-neutrality
Based on this Vox article - http://www.vox.com/2015/10/9/9483803/grid-neutrality
Tuesday, October 6, 2015
Github workflow
Source Control error (after adding a file?);
fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
WTF!?!
Here's the workflow in pictures, dummy!
Setting up a new gitHubbed project
1.
Fork the repo to your own gitHub |
Clone your repo to a local repo |
git clone (the URL) to create local repo in the parent directory |
5. Open the project in Xcode and check history to ensure you have proper copy
Open the project in Xcode and check history to ensure you have proper copy |
new branch |
7.
Saving & merging your changes
1. Make some changes2. Commit (and Push?) the changes
Commit & Push as separate operations |
3. Merge the changes (from the Command line???)
Subscribe to:
Posts (Atom)