iOS 6 UITabBarController supported orientation with current UINavigation controller

Subclass your UITabBarController overriding these methods: -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // You do not need this method if you are not supporting earlier iOS Versions return [self.selectedViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation]; } -(NSUInteger)supportedInterfaceOrientations { return [self.selectedViewController supportedInterfaceOrientations]; } -(BOOL)shouldAutorotate { return YES; } Subclass your UINavigationController overriding these methods: -(NSUInteger)supportedInterfaceOrientations { return [self.topViewController supportedInterfaceOrientations]; } -(BOOL)shouldAutorotate { return YES; } … Read more

Embed a UIViewController in a NavigationController using segues

In your Storyboard, you can embed a ViewController in a Navigation Controller by selecting the View Controller and then picking from the menu at the top Editor->Embed In->Navigation Controller. From another view controller, you control drag to this Navigation controller to set up the modal segue. You can also control drag to the original View … Read more

How to constrain autorotation to a single orientation for some views, while allowing all orientations on others?

The short answer is that you’re using UINavigationController, and that won’t work like you want it to. From Apple’s docs: Why won’t my UIViewController rotate with the device? All child view controllers in your UITabBarController or UINavigationController do not agree on a common orientation set. To make sure that all your child view controllers rotate … Read more

How to add 2 buttons into the UINavigationbar on the right side without IB?

With iOS 5+ it’s as easy as: UIBarButtonItem *btnShare = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(share)]; UIBarButtonItem *btnRefresh = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(refresh)]; [self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:btnShare, btnRefresh, nil]];

iPhone: Setting Navigation Bar Title

The view controller must be a child of some UINavigationController for the .title property to take effect. If the UINavigationBar is simply a view, you need to push a navigation item containing the title, or modify the last navigation item: UINavigationItem* item = [[UINavigationItem alloc] initWithTitle:@”title text”]; … [bar pushNavigationItem:item animated:YES]; [item release]; or bar.topItem.title … Read more

Why can’t I force landscape orientation when use UINavigationController?

Best way to do this is the create extend UINavigationController and write your orientation function inside the extended class. Class Declaration: @interface MyNavigationControllerViewController : UINavigationController @property(nonatomic, assign) UIInterfaceOrientation orientation; @property(nonatomic, assign) NSUInteger supportedInterfaceOrientatoin; @end Implementation of MyNavigationController @implementation MyNavigationController @synthesize supportedInterfaceOrientatoin = _supportedInterfaceOrientatoin; @synthesize orientation = _orientation; – (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = … Read more

Meaning of Warning “while a presentation is in progress!”

// Breaks [viewController1 dismissViewControllerAnimated:YES completion:NULL]; [self presentViewController:viewController2 animated:YES completion:NULL]; // Does not break [viewController1 dismissViewControllerAnimated:YES completion:^{ [self presentViewController:viewController2 animated:YES completion:NULL]; }]; The Swift 3 version of the above code would look like this: // Breaks viewController1.dismiss(animated: true) present(viewController2, animated: true) // Does not break viewController1.dismiss(animated: true) { present(viewController2, animated: true) } Note the use of … Read more

How to set back button text in iOS navigation controller?

The back button belongs to the previous view controller, not the one currently presented on screen. To modify the back button you should update it before pushing, on the view controller that initiated the segue: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { let backItem = UIBarButtonItem() backItem.title = “Something Else” navigationItem.backBarButtonItem = backItem // This … Read more

change color navigation controller in a popover

//////////////////////////////////////// ////////////**SOLUTION**//////// //////////////////////////////////////// I’m gonna edit this post because i solved my problem and I think could be helpful share my solution here: first of all, follow this sample: http://mobiforge.com/designing/story/using-popoverview-ipad-app-development When It is done go to step two. The second step will be add a new popoverBackgroundViewClass: Add new file in your project Objective class … Read more