Tech and a few other things RSS 2.0
# Saturday, April 07, 2012




It's easy, so easy, it makes you a tiny bit happy inside once you see how easy it is. I'll post the code then give an explanation for those of you that want more.

CODE:

// create a done view + done button, attach to it a doneClicked action, and place it in a toolbar as an accessory input view...
// Prepare done button

UIToolbar* keyboardDoneButtonView = [[UIToolbar alloc] init];
keyboardDoneButtonView.barStyle = UIBarStyleBlack;
keyboardDoneButtonView.translucent = YES;
keyboardDoneButtonView.tintColor = nil;
[keyboardDoneButtonView sizeToFit];

UIBarButtonItem* doneButton    = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:self action:@selector(pickerDoneClicked:)];
// I put the spacers in to push the doneButton to the right side of the picker view UIBarButtonItem *spacer1    = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
// I put the spacers in to push the doneButton to the right side of the picker view
UIBarButtonItem *spacer    = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; [keyboardDoneButtonView setItems:[NSArray arrayWithObjects:spacer, spacer1, doneButton, nil]]; // Plug the keyboardDoneButtonView into the text field... self.businessType.inputAccessoryView = keyboardDoneButtonView;
Bam, and you are done.

Explanation:
For nearly every input field (I focus on the UITextField here) in objective-C iOS you can choose one of the core SDK libraries input tools to pop up, whether this is a keyboard or a picker, or one of the many others to choose from. You simply need to assign the input tool to the inputview, but what I stumbled across is Apple so graciously made an additional built in view to give you just a touch more creative flexiblity, it's the inputAccessoryView and it sits on top of the inputView.  All you have to do is stuff another view into the inputAccessoryView. I imagine you could put whatever you want, but a UIToolbar seems to be the unspoken consensus on what to use. Put a few buttons in the UIToolbar and set it as the inputAccessoryView. Done. Yeah. It's not complex, but a nice to have.

Easy enough!



Saturday, April 07, 2012 2:26:23 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Objective C | xCode
# Friday, March 23, 2012
Soo one can say I swing both ways Windows and OS X. Both have their advantages and each has a particular tool set that I would like to see on the other. In this situation I was wanting a nice GUI for SVN and GiT. I'm on two different projects that use one or the other. With my exhaustive 30 minutes of research here are the two best tools that I came up with and have been using for about 3 months now (screenshots were grabed much earlier).

For SVN I downloaded Versions.
Pro: Best tool around, closest thing you can get to Tortoise SVN for Windows
Con: 60 bucks...sixty freaking bucks. I let Capital One graciously buy this for me. Would I pay sixty for personal use. If I used SVN day in and out for my work, yes. Though most of my personal work resides on GiT now.




For GiT I use GitBox
Pro: Best GiT tool around hands down. Nearly all will agree who use GiTBox in comparison with the others.
Con: While it's free to use, you can only have one project at a time with the freemium version. To get more projects going you need to pay $20. $20 is doable for a tool that you potentially use multiple times a day, nearly everyday.




Remember with both of these tools you cannot checkout the code from a remote repository with them, you must use the Terminal to check out the code base then use either of these tools and point them to wherever you checked out the repository too. NOTE: GiT and SVN are built in natively to OS X
Friday, March 23, 2012 5:19:12 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
GiT | Mac OS X | subversion | Tools
# Wednesday, March 21, 2012


Solution:

The important thing to remember is that whenever you want to to make a mutable copy of NSMutableArray or NSMutableDictionary, or most likely anything with mutable in the name always use "mutableCopy." Do NOT simply assign one mutable dictionary to another. Like so

Wrong:
NSMutableDictionary *mutableUsers = mutableDictionaryOfUsers;

Right:
NSMutableDictionary *mutableUsers = [mutableDictionaryOfUsers mutableCopy];

Problem:
After pounding my head for more than I would like to admit I edu-micated myself to find out that if one has two NSMutableDictionaries and one tries to set one NSMutableDictionary to the other without using the method "mutableCopy" it simply passes a NSDictionary. If you notice in my wrong example I was simply receiving a NSDictionary of mutableUsers and when I was trying to modify the dictionary or append to the dictionary it was failing.

Hope this helps someone somewhere.....

Wednesday, March 21, 2012 4:47:10 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Objective C
# Thursday, February 23, 2012


Turns out this isn't too hard, just a few simple things to understand.
1. If you are creating a TabBar Controller, the TabBar Controller will always have to be the root view.
2. Once you know the last step the next step is to see what view or xib the TabBar controller calls first. Once you know what xib or view gets called first go to the view or xib's view controller code. In that code create function

-
(void) viewDidAppear:(BOOL)animated { }


Within the above function you can inject the navigation view, but first you must tell the navigation view what the first view you want to be displayed, done like this:

PersonalInfoVC *personalInfoVC = [[PersonalInfoVC alloc] initWithNibName:@"PersonalInfoVC" bundle:nil]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:personalInfoVC]; [self.tabBarController presentModalViewController:navController animated:YES];


Next in each subsequent view in the navigation controller you can call the view after it like so

DepositDetailsVC *depositDetailsVC = [[DepositDetailsVC alloc] initWithNibName:@"DepositDetailsVC" bundle:nil]; [self.navigationController pushViewController:depositDetailsVC animated:YES];


Finally when you are done with the flow of the injected navigation controller run this code to go back to your original TabBar controller

[self.navigationController dismissModalViewControllerAnimated:YES];

Easy enough. :)

Thursday, February 23, 2012 7:29:19 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
iphone | iphone | Mobile | Objective C
# Monday, February 06, 2012


Problem:
You need Admin rights on your Mac because you forgot your admin password and your current account doesn't have admin rights.

Solution:
1. Turn on the computer and when you hear the startup chime hold CMD+S
2. At the prompt type in: "/sbin/mount -uw"
3. Now type "rm /var/db/.applesetupdone"
4. Type "reboot"
5. Go through the rest of the setup process. Select "Do Not Transfer My Data"
6. Be sure to make the admin account different from the existing one.

Explanation:
I stumbled on this gem today. It allows one to give themselves admin rights on any Apple computer running Snow Leopard (maybe Lion didn't try). Frankly, it's quite scary how easy it is and how clever it is in what it does.
-- In short it deletes the file that tells the Mac that one has logged into the machine...ever, as in it thinks this is your initial setup stage, however it doesn't delete any other accounts created. Once you log-in as admin you have the ability to grant any account you like with admin rights, logout of the newly created account and then log-in as your old account now with admin rights. Once you are in you have the ability to delete your newly created admin account making it look like it never existed.

Monday, February 06, 2012 8:37:18 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Mac | Snow Leopard
Navigation
About the author/Disclaimer
        

My name is Ben Coffman. Currently leading the release of Mobile into Canada for Capital One. I have a strong focus on mobile development, building effective development teams and a drive for rapid prototyping and continuous integration using nearly all SDLCs. When I turn the internet off I focus on my family, random hobbies, and sharing moments in life.

My pseudo provactive thoughts
--> Twitter @coffmanben

Learn About Me
--> Linkedin

Blogs I follow:
  1. Big Nerd Ranch
  2. Jeff Lamarche
  3. Scott Hanselman

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Ben Coffman

Archive
<April 2012>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345
All Content © 2013,

Sign In