Friday, October 31, 2014

Using an NSString in a switch statement

Define Macros

#define CASE(str)                       if ([__s__ isEqualToString:(str)])
#define SWITCH(s)                       for (NSString *__s__ = (s); ; )
#define DEFAULT


SWITCH (string) {
    CASE (@"AAA") {
    CASE (@"BBB") {
    CASE (@"CCC") {

Tuesday, October 28, 2014

Ipad stuck on the red battery charging

Fixes these items on your Ipad:
  • Device continually restarts but never displays the Home screen.
  • An update or restore did not complete and the device is no longer recognized in iTunes.
  • Stops responding, showing the Apple logo with no progress bar or a stopped progress bar, for over ten minutes.
Here’s what you’ll need to do to get your Ipad into DFU mode:
  • Plug the iPad into your computer
  • Launch iTunes
  • Hold down the Power button and the Home button at the same time
  • Keep holding both of these buttons for 10 seconds
  • After 10 seconds pass, release the Power button but continue to hold the Home button for another 3-5 seconds
  • When in DFU mode, your iPad screen will stay completely black. If you see an Apple logo or otherwise you did not enter DFU mode
  • iTunes will notify you that it has detected a device in recovery mode
  • Once in DFU mode the Itunes firmware modifying app will take over, follow those instructions
What is Ipad DFU mode?
DFU stands for Device Firmware Update, entering DFU Mode allows you to update or re install your Ipad, Ipod, or other iOS device’s firmware.

Thursday, October 16, 2014

Get Root ViewController of StoryBoard


UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
    UINavigationController *NavController = (UINavigationController*)[mainStoryboard instantiateViewControllerWithIdentifier:@"NavController"];

    UIViewController *TheViewController=[[NavController viewControllers] objectAtIndex:0];

You need to specify the controller identifier for your navigation controller in the attributes inspector of the navigation controller