Converting Storyboard from iPhone to iPad

I found out a kind of solution: Duplicate your iPhone-Storyboard and rename it MainStoryboard_iPad.storyboard Close Xcode and then open this file any text editor. Search for targetRuntime=”iOS.CocoaTouch”and change it to targetRuntime=”iOS.CocoaTouch.iPad” Change the code in the MainStoryboard_iPad.storyboard from: <simulatedScreenMetrics key=”destination” type=”retina4″/> to <simulatedScreenMetrics key=”destination”/> Now save everything and reopen Xcode. The iPad-Storyboard has the same … Read more

How can I load storyboard programmatically from class?

In your storyboard go to the Attributes inspector and set the view controller’s Identifier. You can then present that view controller using the following code. UIStoryboard *sb = [UIStoryboard storyboardWithName:@”MainStoryboard” bundle:nil]; UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@”myViewController”]; vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentViewController:vc animated:YES completion:NULL];

What is a StoryBoard ID and how can I use this?

The storyboard ID is a String field that you can use to create a new ViewController based on that storyboard ViewController. An example use would be from any ViewController: //Maybe make a button that when clicked calls this method – (IBAction)buttonPressed:(id)sender { MyCustomViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@”MyViewController”]; [self presentViewController:vc animated:YES completion:nil]; } This will create … Read more

How to change Navigation Bar color in iOS 7?

The behavior of tintColor for bars has changed in iOS 7.0. It no longer affects the bar’s background. From the documentation: barTintColor Class Reference The tint color to apply to the navigation bar background. @property(nonatomic, retain) UIColor *barTintColor Discussion This color is made translucent by default unless you set the translucent property to NO. Availability … Read more

How to pass prepareForSegue: an object

Simply grab a reference to the target view controller in prepareForSegue: method and pass any objects you need to there. Here’s an example… – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Make sure your segue name in storyboard is the same as this line if ([[segue identifier] isEqualToString:@”YOUR_SEGUE_NAME_HERE”]) { // Get reference to the destination view controller … Read more